$(function(){ /*about*/ var _texttop = 0; var _ah = $(".about-text").height(); var _th = 160; var _t = _ah - 160; var _abouttop; var _aboutbottom; $(".about-box .bottom").hover(function(){ _aboutbottom = setinterval(aboutbottom,100); },function(){ clearinterval(_aboutbottom); }); $(".about-box .top").hover(function(){ _abouttop = setinterval(abouttop,100); },function(){ clearinterval(_abouttop); }); function abouttop(){ if(_texttop-20 > 0 ){ _texttop = _texttop-20; }else{ _texttop = 0; } $(".about-text").stop().animate({"top":-_texttop},200); } function aboutbottom(){ if(_t > 0 && _t > _texttop+20){ _texttop = _texttop+20; }else if(_t > 0){ _texttop = _t; }else{ _texttop = 0; } $(".about-text").stop().animate({"top":-_texttop},200); } /*header*/ //var _navliw = $("#nav .nli").width(); //$("#nav .head-sub").find("p").width(_navliw); //$("#nav .sub-nav-i").css({"margin-left":-_navliw/2}); $(".subli").mouseenter(function(){ //$(".head-sub").stop(true,true).slidedown(300); var _sublilength = $(this).find(".head-sub").find("p").length; //$(this).find(".head-sub").width(_navliw*_sublilength); //$(this).find(".head-sub").css({"margin-left":-_navliw}); $(this).find(".head-sub").width(100*_sublilength); //$(this).find(".head-sub").css({"margin-left":-100}); $(".head-nav-bg").stop(true,true).slidedown(300); $(this).find(".head-sub").stop(true,true).slidedown(300); $(this).find(".head-sub-row").fadein(300); }) $(".sub-nav p").mouseleave(function(){ $(this).find(".sub-nav-i").stop().animate({"width":0},300); }) $(".sub-nav p").mouseenter(function(){ $(this).find(".sub-nav-i").stop().animate({"width":"100%"},300); }) $(".subli").mouseleave(function(){ $(".head-sub").stop(true,true).slideup(300); $(".head-nav-bg").stop(true,true).slideup(300); $(this).find(".head-sub-row").fadeout(300); }) $("#head-search .search").click(function(){ if($(this).attr("class").indexof("on") != -1){ $(".head-search-bg").stop(true,true).slideup(300); $(this).removeclass("on"); }else{ $(".head-search-bg").stop(true,true).slidedown(300); $(this).addclass("on"); } }); /*index*/ /*$(".index-ban,.index-ban .banner li,.index-ban .banner li #bg,.index-ban ul").css({"height":_wh-120}); $(".index-ban-sol").css({"margin-top":(_wh-120)*0.6}); $(".banner > ul > li").loadimage(true,$(".banner > ul > li"));*/ $(".index-ban").slide({maincell:".bd ul",effect:"fold",autoplay:true}); $(".index-chl-01 .b50,.index-chl-02 .b50,.index-waist .b50,.index-chl-03 .b50,.index-chl-04 .b50").css({"opacity":0}); $(".index-chl-01").hover(function(){ $(this).find(".top,.bottom").stop(true,true).animate({"width":0},1000); $(this).find(".top-cur,.bottom-cur").stop(true,true).delay(300).animate({"width":"100%"},1000); $(this).find(".b50").stop(true,true).animate({"opacity":1}); },function(){ $(this).find(".top,.bottom").stop().animate({"width":"100%"},1000); $(this).find(".top-cur,.bottom-cur").stop(true,true).delay(300).animate({"width":0},1000); $(this).find(".b50").stop(true,true).animate({"opacity":0}); }); $(".index-chl-02").hover(function(){ $(this).find(".fl").stop().animate({"margin-left":15},500,"linear"); $(this).find(".b50").stop(true,true).animate({"opacity":1}); },function(){ $(this).find(".fl").stop().animate({"margin-left":5},500,"linear"); $(this).find(".b50").stop(true,true).animate({"opacity":0}); }); $(".index-chl-03").hover(function(){ $(this).find(".b50").stop(true,true).animate({"opacity":1}); },function(){ $(this).find(".b50").stop(true,true).animate({"opacity":0}); }); $(".index-chl-04").hover(function(){ $(this).find(".b50").stop(true,true).animate({"opacity":1}); },function(){ $(this).find(".b50").stop(true,true).animate({"opacity":0}); }); $(".index-news").slide({titcell:".hd ul",maincell:".bd ul",autopage:true,effect:"leftloop",autoplay:true,vis:1}); $(".index-waist").hover(function(){ $(this).find("i").stop().animate({"width":0,"margin-left":0},500,function(){ $(this).stop().animate({"width":74,"margin-left":-36},500); }); $(this).find(".b50").stop(true,true).animate({"opacity":1}); },function(){ $(this).find(".b50").stop(true,true).animate({"opacity":0}); }) /*footer*/ $(".footer-links").hover(function(){ $(this).find(".footer-links-box").stop().slidedown(300); },function(){ $(this).find(".footer-links-box").stop().slideup(300); }); $(".weixin").hover(function(){ $(this).find(".wx-div").stop().slidedown(300); },function(){ $(this).find(".wx-div").stop().slideup(300); }); $(".sina").hover(function(){ $(this).find(".sina-div").stop().slidedown(300); },function(){ $(this).find(".sina-div").stop().slideup(300); }); /*his*/ var _moused = false;//判断鼠标按下 var _mousepx = 0;//鼠标按下时的x var _mousex = 0;//鼠标当前的x var _scpl = 0;//当前纽扣的left var _menunum = 0;//menu移动个数 var _hisbdul = 0;//ul移动个数 var _hislilength = $(".his-bg .bd li").length;//li(年份)个数 //$(".his-bg .bd ul").width(1000*_hislilength); $(".scale-div ul").width(148*(_hislilength - 1)); $(".year-div ul").width(136*_hislilength); /*$(".his-bg .bd li").css({"opacity":0}); $(".his-bg .bd li").eq(0).css({"opacity":1});*/ $(".his-bg .bd li").eq(0).fadein(100); $("#sc-buttom").mousedown(function(e){ e = e || window.event; _moused = true; _mousepx = e.pagex; _scpl = $("#sc-buttom").position().left;//当前纽扣的left }); $(".his-bg").mouseup(function(e){ e = e || window.event; _mousepx = 0; _mousex = 0; if(_moused == true){ _scpl = $("#sc-buttom").position().left;//移动后纽扣的left scbuttomleft(); } _moused = false; }); $(".his-bg").mousemove(function(e){ e = e || window.event; if(_moused == true){ _mousex = e.pagex; var _btnl = _mousex - _mousepx;//鼠标移动距离 var _movel = _scpl + _btnl;//纽扣应该移动的left _movel < 0 ? _movel = 0 : _movel = _movel; _movel > 816 ? _movel = 816 : _movel = _movel; $("#sc-buttom").css({"left":_movel}); $(document).bind('selectstart',function(e){ // 防止页面内容被选中 ie return false; }); e.preventdefault(); } }) $("#sc-buttom").mousemove(function(e){ e = e || window.event; $(document).bind('selectstart',function(e){ // 防止页面内容被选中 ie return false; }); e.preventdefault(); }) $(".his-bg .next").click(function(){ /*_menunum++; _menunum > _hislilength - 7 ? _menunum = _hislilength - 7 : _menunum = _menunum; hismenuleft();*/ _scpl = $("#sc-buttom").position().left;//当前纽扣的left _scpl = _scpl + 148;//纽扣应该移动的left if(_scpl > 888){ _menunum++; if(_menunum > _hislilength - 7 ){ _menunum = 0; _scpl = 0; }else{ _menunum = _menunum; _scpl = 888; } }else{ _scpl = _scpl ; } hismenuleft(); scbuttomleft(); }); $(".his-bg .prev").click(function(){ /*_menunum--; _menunum < 0 ? _menunum = 0 : _menunum = _menunum; hismenuleft();*/ _scpl = $("#sc-buttom").position().left;//当前纽扣的left _scpl = _scpl - 148;//纽扣应该移动的left if(_scpl < 0){ _menunum--; if(_menunum < 0){ _menunum = _hislilength - 7; _scpl = 888; }else{ _menunum = _menunum; _scpl = 0; } }else{ _scpl = _scpl; } hismenuleft(); scbuttomleft(); }); $(".scale-div li,.year-div li").click(function(){ var aa=$(this).index(); _menunum=aa; _scpl = $("#sc-buttom").position().left;//当前纽扣的left _scpl = _scpl - 148;//纽扣应该移动的left if(_scpl < 0){ if(_menunum < 0){ _menunum = _hislilength - 7; _scpl = 888; }else{ _menunum = _menunum; _scpl = 0; } }else{ _scpl = _scpl; } hismenuleft(); scbuttomleft(); }) function hismenuleft(){//menu切换 $(".scale-div ul").stop().animate({"left":-_menunum*136},300); $(".year-div ul").stop().animate({"left":-_menunum*136},300); hisbdleft(_menunum+_hisbdul); } function hisbdleft(k){//历史内容切换 //$(".his-bg .bd ul").stop().animate({"left":-1000*k},300); //$(".his-bg .bd ul li").eq(k).stop().animate({"opacity":1},300).siblings().stop().animate({"opacity":0},300); $(".his-bg .bd ul li").eq(k).stop(true,true).fadein(300).siblings().stop(true,true).fadeout(300); $(".year-div li").removeclass("on").eq(k).addclass("on"); } function scbuttomleft(){//按钮移动 for (var i = 0; i <= _hislilength; i++) { if( _scpl >= (i*148-68) && _scpl <= (i*148+70) ){ _scpl = i*148; _hisbdul = i; break; } };//按钮移动偏差定位 $("#sc-buttom").stop().animate({"left":_scpl},100); hisbdleft(_menunum+_hisbdul); } /*contact*/ $(".sselect").hover(function(){ $(this).find(".sselect-div").stop(true,true).slidedown(300); },function(){ $(this).find(".sselect-div").stop(true,true).slideup(300); }) $(".cselect").hover(function(){ $(this).find(".cselect-div").stop(true,true).slidedown(300); },function(){ $(this).find(".cselect-div").stop(true,true).slideup(300); }) /*honor*/ $(window).scroll(function() {//定义滚动条位置改变时触发的事件。 _scroh=$("body").get(0).scrollheight;//得到滚动条总长,赋给hght变量 _scrot=$(window).scrolltop();//得到滚动条当前值,赋给top变量 }); /*newpro*/ //$(".newpro-left,.newpro-right,.newpro-left .b50,.newpro-right .b50").css({"height":_wh - 64 - 200}); $(".newpro-left,.newpro-right").hover(function(){ $(this).find(".b50").stop().animate({"opacity":1},500); },function(){ $(this).find(".b50").stop().animate({"opacity":0},500); }); $(".newpro-left,.newpro-right").find(".b50").css({"opacity":0}); /*newprolist*/ $(".newpro-list li").hover(function(){ $(this).find(".ablock").stop().animate({"opacity":1},500); $(this).find(".img-view").stop().animate({"opacity":1},500); /*$(this).stop().animate({"width":560},500); $(".newpro-list ul").width($(".newpro-list ul").width()+242); var _newproscroleft = $(".newpro-list-box").scrollleft(); $(".newpro-list-box").stop().animate({scrollleft:_newproscroleft+242},500);*/ },function(){ var _newproscroleft = $(".newpro-list-box").scrollleft(); $(this).find(".ablock").stop().animate({"opacity":0},500); $(this).find(".img-view").stop().animate({"opacity":0},500); /*$(this).stop().animate({"width":318},500,function(){ $(".newpro-list ul").width($(".newpro-list ul").width()-242); }); $(".newpro-list-box").stop().animate({scrollleft:_newproscroleft-242},500);*/ }) $(".newpro-list li").find(".ablock").css({"opacity":0}); $(".newpro-list li").find(".img-view").css({"opacity":0}); $("a[rel='newpropic']").fancybox({ "padding":0, "overlaycolor":"#000", "titleshow":false }); /*prolist*/ $(".pro-list-div").on('mouseenter mouseleave','.pro-list li',function(event){ if(event.type == "mouseout" || event.type == "mouseleave"){ //$(this).find(".prolist-cur-img").hide(); $(this).find("img").addclass("on"); }else{ //$(this).find(".prolist-cur-img").show(); $(this).find("img").removeclass("on"); } }) /*if(_wh > _bh){ $(".pro-list-menu,.store-img").css({"height":_wh - 64 - 200}); }else{ $(".pro-list-menu,.store-img").css({"height":_bh - 64 - 200}); }*/ var _prolistconw = _ww * 0.75; var _prolistconh = _wh - 64 - 200; var _prolistbodyh = ((((_prolistconw * 0.2) / 287) * 379) * 2) + 42*3; if( _prolistbodyh > _prolistconh){ $(".pro-list-menu-pro").css({"height":_prolistbodyh}); }else{ $(".pro-list-menu-pro").css({"height":_prolistconh}); } /*store*/ $(".store-menu .bd").on('mouseenter mouseleave','li',function(event){ if(event.type == "mouseout" || event.type == "mouseleave"){ if($(this).attr("class").indexof("cur") == -1){ $(this).addclass("on"); } }else{ $(this).removeclass("on"); } }) /*custom*/ $(".custom-tit").hover(function(){ $(this).find(".b50").stop().animate({"opacity":1},500); },function(){ $(this).find(".b50").stop().animate({"opacity":0},500); }); $(".custom-tit").find(".b50").css({"opacity":0}); $(".custom-list").on('mouseenter mouseleave','li',function(event){ if(event.type == "mouseout" || event.type == "mouseleave"){ $(this).find("img").addclass("on"); }else{ $(this).find("img").removeclass("on"); } }) /*news*/ var $container = $('.news-list'); $container.masonry({ itemselector: '.news-box' }); $(".news-list").on('mouseenter mouseleave','.news-box',function(event){ if(event.type == "mouseout" || event.type == "mouseleave"){ $(this).removeclass("on"); $(this).find(".news-hover-bg").stop(true,true).animate({"opacity":0},300); //$(this).stop().animate({"background":"none"},300); }else{ $(this).addclass("on"); $(this).find(".news-hover-bg").css({"background":"#fff","opacity":0}).stop(true,true).animate({"opacity":1},300); //$(this).stop().animate({"background":"#fff"},300); } }) $(".news-ban").slide({maincell:".bd ul",effect:"fold",autoplay:true}); $(".news-ban").hover(function(){ $(this).find(".hd").stop().animate({"bottom":0},500); },function(){ $(this).find(".hd").stop().animate({"bottom":-50},500); }) //小屏 if(_wh < 750){ $(".his-bg .year").css({"font-size":"170px"}); $(".his-bg .bd,.his-bg .bd ul,.his-bg .bd li").css({"height":500}); $(".his-bg .div-text").css({"margin":"60px auto 0px"}); } }) var _scroh=0;//初始化滚动条总长 var _scrot=0;//初始化滚动条的当前位置 var _page = 2;//加载的页码 var _wh = $(window).height(); var _ww = $(window).width(); //var _bh = $("body").height(); var interval; interval = setinterval("loadajax();",1000);//每隔1秒钟调用一次cando函数来判断当前滚动条位置。 function loadajax(){ if(_scron == "honor"){ if(_scrot + _wh >_scroh - 50){//判断滚动条都滚动到底部 - 50 loadhonor(); } }else if(_scron == "media"){ if(_scrot + _wh >_scroh - 50){//判断滚动条都滚动到底部 - 50 loadmedia(); } }else if(_scron == "news"){ if(_scrot + _wh >_scroh - 50){//判断滚动条都滚动到底部 - 50 loadnews(); } } } function loadhonor(){ $("#loadimg").show(); var html = $.ajax({ url : _xml + "/" + _page, async: false, success:function(msg){ $("#loadimg").hide(); var _str = $(msg); $(".honor-list ul").append(_str);//用append方法追加内容。; _scroh=$("body").get(0).scrollheight; _scrot=$("body").scrolltop(); var _maxp = $("#zsum").val(); if(_page >= _maxp){ cleartimeout(interval); }else{ _page ++; } } }); } function loadmedia(){ $("#loadimg").show(); var html = $.ajax({ url : _xml + "/" + _page, async: false, success:function(msg){ $("#loadimg").hide(); var _str = $(msg); $(".media-div ul").append(_str);//用append方法追加内容。; _scroh=$("body").get(0).scrollheight; _scrot=$("body").scrolltop(); _page ++; } }); } function loadnews(){ $("#loadimg").show(); //var _newurl = ; var html = $.ajax({ url : _xml + "/" + _page, async: false, success:function(msg){ $("#loadimg").hide(); //var _str = $(html.responsetext); var _str = $(msg); $(".news-list").append(_str).masonry('appended', _str);//用append方法追加内容。; _scroh=$("body").get(0).scrollheight; _scrot=$("body").scrolltop(); _page ++; } }); }