// [jquery 代码] ============================================================================================= $(function(){ //dom对象加载完成后执行 $(".marquee2 .name").each(function(){ }); $(".marquee2 .cont").each(function(){ }); //*******************************************************************设为首页 (获取地址没做处理,以后有待修改) $(".setindex").css("cursor","pointer").click(function(){this.style.behavior='url(#default#homepage)';this.sethomepage(location.href); return false; }); //*******************************************************************加入收藏 (external对象中的addfavorite方法中地址一定要带http://否则不会运行) $(".addfavorite").css("cursor","pointer").click(function(){ window.external.addfavorite(location.href, document.title); return false; }); //*******************************************************************插入当前日期 $(".nowdate").text(function(){ var today = new date(); var week = ["日","一","二","三","四","五","六"]; var date = "今天是:" + today.getfullyear() +"年"+ (today.getmonth()+1) +"月"+ today.getdate() +"日 星期"+ week[today.getday()]; //年、月、日、星期 return date; }); //*******************************************************************友情链接隐藏 $(".ylink").css({'position':'absolute','left':'-9999px','width':'100px','height':'100px','overflow':'hidden'}) $(".nav_hover li").hover(function(){$(this).children("ul").slidetoggle("fast");},function(){$(this).children("ul").slideup("fast");}); //*******************************************************************鼠标经过 子标签动作 $(".nav li").hover(function(){$(this).animate({"text-indent": "0px"}, "fast");},function(){$(this).animate({"text-indent": "0px"}, "fast");}); //*******************************************************************指定dom对象加图片编号 /* addico($(".textlist .images")); function addico(myimg){ for(i=0; i<=myimg.length-1; i++){ if(i<9){myindex = "0" + ( i + 1 );}else{myindex = i + 1;}; myimg.eq(i).append("" ); }; }; */ //*******************************************************************禁止复制、下载、右击 (去掉注释打开该功能) /* document.oncontextmenu = function(){alert("本站内容禁止复制!"); return false; }; //禁止右键弹出上下文菜单 document.onselectstart = function(){return false;}; //禁止选择文本 document.ondragstart = function(){return false;}; //禁止鼠标在网页上拖动 document.onbeforecopy = function(){return false;}; //禁止复制 document.oncopy = document.selection.empty(); //禁止拷贝 document.onselect = document.selection.empty(); //禁止选择 */ //*******************************************************************页眉横幅广告自动收起效果 /* settimeout(closetopad,17000); function closetopad(){ $(".topad").slideup("slow"); $(".topad").html(""); } */ //*******************************************************************点击展开栏目 $(".nav_hover li").click(function(e){ $(this).children("ul").slidetoggle("fast"); $(this).siblings().children("ul").slideup("fast"); e.stoppropagation(); }); //*******************************************************************判断有无子菜单并加背景 $(".nav_hover li").addclass(function(){ if($(this).children("ul").length == 0){ return "current"; } }); //*******************************************************************根据当前页并展开菜单 /* var doc_url = document.location.href; var urltodir_regex = /(\w+):\/\/([\w.]+)(\/\s*\/)/; var url_regexed = doc_url.match(urltodir_regex); if(url_regexed!=null){ var doc_dir = url_regexed[3]; $(".nav_hover li a[href='"+doc_dir+"']").parents("ul").css("display","block"); $(".nav_hover li a[href='"+doc_dir+"']").next("ul").css("display","block"); } */ }); $(window).load(function(){ $('.columnsicolist .image').each(function(){ comm.zoomhv($(this), $(this).find('img')); }); $(".ncontainer1_2_3 .columnsicolist").pagination({ pagesize : 12, //每页几条 pagenum : 20, //页码显示个数,使用双数 backfunc:function($row){ $row.find(".image").each(function(){ comm.zoomhv($(this), $(this).find('img')); }); } }); }); // [jquery 插件] ============================================================================================= //***************************************************选项卡插件 /* * tab 0.9 选项卡 * copyright (c) 2014 zhibinpu * date: 2014-9-17 * jquery-1.11.1.min.js */ (function($){ $.fn.tab = function(options){ var $label = this.find("dt"); var $cont = this.find("dd"); act($label.eq(1)); $label.click(function(){act($(this));}); function act(obj){ $label.removeclass("show"); $cont.removeclass("show"); obj.addclass("show"); obj.next().addclass("show"); }; }; })(jquery); $(function(){$(".tab").tab();}); //***************************************************浮动框插件 /* * floater 0.9 浮动框 * copyright (c) 2013 zhibinpu * date: 2013-12-11 * jquery-1.8.2.min.js */ (function($){ $.fn.floater = function(options){ var defaults = { startposition : 200, //初始位置 moveposition : 100, //移动时相对位置 bottomdistance : 200 //底部距离 } var options = $.extend(defaults, options); this.each(function(){ var scrollbox = $(this); var boxheight = scrollbox.height(); //浮动框自身高度 var boxposition = scrollbox.position().top; //浮动框位置 var bodyheight = $(document.body).height(); //网页整体高度 $(window).scroll(function(){ var offsettop; //当前滚动位置 if( $(document).scrolltop() <= options.startposition ){ offsettop = options.startposition; } else if( $(document).scrolltop() >= bodyheight - boxheight - options.bottomdistance ){ offsettop = bodyheight - boxheight - options.bottomdistance; } else{ offsettop = $(document).scrolltop() + 100; } scrollbox.animate({top:offsettop},{duration:600,queue:false}); $(".output").html("当前浮动框离顶部距离" + offsettop + "
" +(bodyheight - boxheight - options.bottomdistance)); }); }); }; })(jquery); $(function(){$(".scrollbox").floater();}); /*************************首页图片切换***************************/ (function($){ $.fn.photochange = function(options){ var speed = 1000; var timeout = 5000; var $img = this.children("img"); //图片容器样式 this.css({ position:"relative", overflow:"hidden" }); //图片样式 $img.css({ position:"absolute", top:"0", left:"0", opacity: "0.0" }); $img.first().css({ opacity: "1.0" }); settimeout(function(){ shownext(0, 1); }, timeout); function shownext(c, n){ $($img[c]).animate({opacity: 0.0}, speed); $($img[n]).animate({opacity: 1.0}, speed); c = n; n = (n >= $img.length - 1) ? 0 : n+1; settimeout(function(){ shownext(c, n); }, timeout); }; }; })(jquery); $(function(){ $(".picfade").photochange(); $(".picfade2").photochange(); }); //***************************************************图片墙插件 /* * photowall 0.9 图片缩图片墙 * copyright (c) 2013 zhibinpu * date: 2013-11-17 * jquery-1.8.2.min.js */ (function($){ $.fn.photowall = function(options){ var defaults = {} var options = $.extend(defaults, options); this.each(function(){ for(var i=0; i < $(this).find("li").length; i++){ $(this).find("li").eq(i).addclass("list_"+(i+1)); outwidth = $(this).find("li").eq(i).width(); $(this).find("img").eq(i).width(outwidth); outheight = $(this).find("li").eq(i).height(); $(this).find("img").eq(i).height(outheight); textposition = $(this).find("li").eq(i).height()-$(this).find(".name").eq(i).height(); $(this).find(".name").eq(i).css({'top': textposition, 'width': outwidth}); } }); }; })(jquery); $(function(){$(".photowall").photowall();}); //***************************************************图片等比缩放居中插件 /* * picscalingvertically 0.91 图片缩放居中 * copyright (c) 2013 zhibinpu * date: 2013-11-19 * jquery-1.8.2.min.js */ (function($){ $.fn.picscalingvertically = function(options){ var defaults = {} var options = $.extend(defaults, options); this.each(function(){ for(var i=0; i < $(this).find("li").length; i++){ $(this).find(".photo a").eq(i).wrap("
"); outwidth = $(this).find(".photo").eq(i).width(); outheight = $(this).find(".photo").eq(i).height(); imgwidth = $(this).find("img").eq(i).width(); imgheight = $(this).find("img").eq(i).height(); if(imgwidth > imgheight){ $(this).find("img").eq(i).width(outwidth-20); }else{ $(this).find("img").eq(i).height(outheight-20); } } }); }; })(jquery); $(function(){$(".photolist").picscalingvertically();}); //***************************************************标签转换插件 /* * labelchange 0.9 标签转换 * copyright (c) 2014 zhibinpu * date: 2014-4-4 * jquery-1.8.2.min.js * 转换所有方括号为尖括号 * 使用方法: $("div").labelchange(); */ (function($){ $.fn.labelchange = function(options){ this.each(function(){ var doc_cont = $(this).html(); var doc_cont_regex = /\[/gi; doc_cont = doc_cont.replace(doc_cont_regex,"<"); var doc_cont_regex = /\]/gi; doc_cont = doc_cont.replace(doc_cont_regex,">"); alert(doc_cont); }); }; })(jquery); // [js 代码] ============================================================================================= //*******************************************************************flash播放 function makeflash(url,width,height){ document.writeln(""); document.writeln(""); document.writeln(""); document.writeln(""); document.writeln(""); }; //*******************************************************************图片轮换效果 function makefocuspic(url,width,height){ document.writeln(""); document.writeln(""); document.writeln(""); document.writeln(""); document.writeln(""); }; //*******************************************************************视频播放 function makevideo(url,width,height){ document.writeln(""); document.writeln(""); document.writeln(""); document.writeln(""); document.writeln("") document.writeln(""); };