$(function () { var pagecontrol = $(".pages .select"); if (pagecontrol.length > 0) { var pagecount = pagecontrol.attr("data-pagetotal"); var html = ""; for (var i = 1; i <= pagecount; i++) { html += ""; } pagecontrol.html(html); } $("a").focus(function () { this.blur(); }); $('.navbtn').click(function () { $('.navpull').height($(window).height()) if ($('.navpull').css("display") == "none") { $('.sp1').addclass('sp1on'); $('.sp2').addclass('sp2on'); $('.sp3').addclass('sp3on'); $('.navpull').stop(true).fadein(10); $('body').addclass('body_on'); } else { $('.sp1').removeclass('sp1on'); $('.sp2').removeclass('sp2on'); $('.sp3').removeclass('sp3on'); $('.navpull').stop(true).fadeout(100); $('body').removeclass('body_on'); } }) //nav $(".link").hover(function () { $(this).find("ul").slidedown(100); }, function () { $(this).find("ul").slideup(100); }); // //搜索s $(".search .icon").click(function () { $(".searchbox").show(); $(".search .icon").addclass("on"); }); $(".search .i2").click(function () { $(".searchbox").hide(); $(".search .icon").removeclass("on"); }); $(".phone_header .search .icon").click(function () { $(".searchbox").show(); $(".phone_header .search .i2").show(); }); $(".phone_header .search .i2").click(function () { $(".searchbox").hide(); $(".phone_header .search .i2").hide(); }); //搜索end $("#navigation .openbtn").toggle(function () { $(this).next(".sub").animate({ height: 'toggle', opacity: 'toggle' }, "fast"); $(".bg").fadein(); }, function () { $(this).next(".sub").animate({ height: 'toggle', opacity: 'toggle' }, "fast"); }); $("#navigation .closebtn").toggle(function () { $(this).parent(".sub").animate({ height: 'toggle', opacity: 'toggle' }, "fast"); $(".bg").fadeout(); }, function () { $(this).parent(".sub").animate({ height: 'toggle', opacity: 'toggle' }, "fast"); }); $("li>span", "#navigation").bind("click", function () { var li = $(this).parent(); if (li.hasclass("fold")) { li.removeclass("fold"); $(this).find("b").removeclass("ui-jia").addclass("ui-jian"); li.find(".foldcontent").slidedown(0); } else { li.addclass("fold"); $(this).find("b").removeclass("ui-jian").addclass("ui-jia"); li.find(".foldcontent").slideup(); } }); //手机导航下拉 $(".homebox .boxcon").mouseover(function () { $(this).addclass("on"); $(this).siblings().removeclass("on"); }); $(".homebox .boxcon").mouseleave(function () { $(this).removeclass("on"); //$(this).siblings().removeclass("on"); }); // $(".history li").each(function (i, item) { if (number(i + 1) % 2 == 0) { $(this).addclass("next"); } }); // $(".stylelist li").each(function (i, item) { if (number(i + 1) % 3 == 0) { $(this).after("
  • "); } }); // $(".menulist .protit").click(function () { $(this).next("ul").slidetoggle(); }); // $(".listbox li").first().addclass("on"); // $("#itembox1 li").each(function (i, item) { if (number(i + 1) % 3 == 1) { $(this).addclass("clear"); } }); $("#itembox2 li").each(function (i, item) { if (number(i + 1) % 3 == 1) { $(this).addclass("clear"); } }); $("#itembox3 li").each(function (i, item) { if (number(i + 1) % 3 == 1) { $(this).addclass("clear"); } }); $("#itembox4 li").each(function (i, item) { if (number(i + 1) % 3 == 1) { $(this).addclass("clear"); } }); // $(".maptxtselect .citytit").click(function () { $(this).next("dl").slidetoggle(); }); // $(".prolist li .box a .img").hover( function () { $(this).children(".infotxt").stop().fadeto(300, 1); }, function () { $(this).children(".infotxt").stop().fadeto(300, 0); } ); // }); $(document).ready(function () { jquery.navlevel2 = function (level1, dytime) { $(level1).mouseenter(function () { varthis = $(this); delytime = settimeout(function () { varthis.find(".subnav").stop().slidedown(); }, dytime); }); $(level1).mouseleave(function () { cleartimeout(delytime); $(this).find(".subnav").stop().slideup(); }); }; $.navlevel2("li.navli", 0); }); // $(".menulist li").each(function () { var btn = $(this).find("span a"); btn.click(function () { var statis = $(this).parents("li").find(".sub").css("display"); if (statis == "none") { $(this).parents("li").siblings().removeclass("onli"); $(this).parents("li").siblings().find(".sub").hide(); $(this).parents("li").addclass("onli"); $(this).parents("li").find(".sub").show(); } else { $(this).parents("li").find(".sub").hide(); $(this).parents("li").removeclass("onli"); } }); }); // //图库 (function () { function g(s) { return document.getelementbyid(s); } function getstyle(obj, attr) { if (obj.currentstyle) { return obj.currentstyle[attr]; } else { return getcomputedstyle(obj, false)[attr]; } } function animate(obj, json) { if (obj.timer) { clearinterval(obj.timer); } obj.timer = setinterval(function () { for (var attr in json) { var icur = parseint(getstyle(obj, attr)); icur = icur ? icur : 0; var ispeed = (json[attr] - icur) / 6; ispeed = ispeed > 0 ? math.ceil(ispeed) : math.floor(ispeed); obj.style[attr] = icur + ispeed + 'px'; if (icur == json[attr]) { clearinterval(obj.timer); } } }, 30); } var opic = g("picbox"); var olist = g("listbox"); var oprev = g("prev"); var onext = g("next"); var oprevtop = g("prevtop"); var onexttop = g("nexttop"); var opicli = opic.getelementsbytagname("li"); var olistli = olist.getelementsbytagname("li"); var len1 = opicli.length; var len2 = olistli.length; var opicul = opic.getelementsbytagname("ul")[0]; var olistul = olist.getelementsbytagname("ul")[0]; var w1 = opicli[0].offsetwidth; var w2 = olistli[0].offsetwidth; opicul.style.width = w1 * len1 + "px"; olistul.style.width = w2 * len2 + "px"; var index = 0; var num = 6; var num2 = math.ceil(num / 2); function change() { animate(opicul, { left: - index * w1 }); if (index < num2) { animate(olistul, { left: 0 }); } else if (index + num2 <= len2) { animate(olistul, { left: - (index - num2 + 1) * w2 }); } else { animate(olistul, { left: - (len2 - num) * w2 }); } for (var i = 0; i < len2; i++) { olistli[i].classname = ""; if (i == index) { olistli[i].classname = "on"; } } } onexttop.onclick = onext.onclick = function () { index++; index = index == len2 ? 0 : index; change(); } oprevtop.onclick = oprev.onclick = function () { index--; index = index == -1 ? len2 - 1 : index; change(); } for (var i = 0; i < len2; i++) { olistli[i].index = i; olistli[i].onclick = function () { index = this.index; change(); } } })()//工作环境