// [jquery 代码] ============================================================================================= $(function(){ //dom对象加载完成后执行 $(".indexcont7_1 li:first").addclass("act").append('
'); //*******************************************************************设为首页 (获取地址没做处理,以后有待修改) $(".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; }); /*******************************************************************导航效果*/ $(".mainnav").hover( function(){ $(".mainnav_l2").slidedown("fast"); }, function(){ $(".mainnav_l2").slideup("fast"); } ) //*******************************************************************插入当前日期 $(".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").stop().slidedown("fast");},function(){$(this).children("ul").stop().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"); } */ }); // [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 + "