$(document).ready(function() { //图片懒加载 $("img.lazyload").lazyload(); //导航下拉 $(function() { $(".nav li").hover(function() { $(this).children(".navbox").stop(true, true).slideDown(500); }, function() { $(this).children(".navbox").stop(true, true).slideUp(0); }) }); //头部浮动 mh = $('body').height(); fh = $('.header').height(); $(window).scroll(function(e){ s = $(document).scrollTop(); if(s > fh){ $('.header').addClass('fixed-head'); }else{ $('.header').removeClass('fixed-head'); } /* topx = $(".productbyy").offset().top - s; if(topx < 0 ){ var leftValue = $(".container").offsetLeft; // var leftValue = $(window).width() - $(".productc").width() - (($(window).width() - $(".container").width())/2); $(".header").removeClass("fixed-head"); $(".header").css("position","absolute"); var heightHead = $(".productb table thead").height(); $(".productbxx").css("height",heightHead); $(".productbxx").css("position","fixed"); $(".productbxx").css("left",leftValue); var jl = $(".productc .relative").offset().left; var gdleft = $(window).scrollLeft(); var lefts = jl - gdleft; $(".productbxx").css("left",lefts); }else{ $(".header").addClass("fixed-head"); $(".header").css("position","fixed"); $(".productbxx").css("height",0); $(".productbxx").css("position","absolute"); $(".productbxx").css("left","auto"); } */ }); $(".fix_ul li").click(function(){ $(this).find(".right_div").show(); }) //通用切换 $('.tabSwitch').each(function(index, element) { var obj = $(this); obj.find('.tabTit').children().on('click tab',function(){ $(this).addClass('cur').siblings().removeClass('cur'); if (obj.find('.tabBox').children().eq($(this).index()).length > 0) obj.find('.tabBox').children().hide().eq($(this).index()).show(); if (obj.find('.tabBox2').children().eq($(this).index()).length > 0) obj.find('.tabBox2').children().hide().eq($(this).index()).show(); return false; }); obj.find('.tabTit .cur').trigger('tab'); }); $('.tabSwitchHover').each(function(index, element) { var obj = $(this); obj.find('.tabTit').children().on('mouseover tab',function(){ $(this).addClass('cur').siblings().removeClass('cur'); if (obj.find('.tabBox').children().eq($(this).index()).length > 0) obj.find('.tabBox').children().hide().eq($(this).index()).show(); if (obj.find('.tabBox2').children().eq($(this).index()).length > 0) obj.find('.tabBox2').children().hide().eq($(this).index()).show(); //return false; }); obj.find('.tabTit .cur').trigger('tab'); }); }); $(document).ready(function() { if($(window).width() <= 1024){ $(".navbtn").click(function(e){ $(".nav_box").animate({left:'0'}); $("body").bind("touchmove",function(event){event.preventDefault(),event.stopPropagation();}); e.stopPropagation(); }); $(".nav_box .navclose").click(function(){ $(".nav_box").animate({left:'-100%'}); $("body").unbind("touchmove"); }); }; }); $(document).ready(function() { npos = $(window).scrollTop(); SW = $(window).width(); SH = $(window).height(); IEFlag = (navigator.appVersion.indexOf("MSIE 7") > -1 || navigator.appVersion.indexOf("MSIE 8") > -1)?true:false; lnbFlag = false; var isrun = false; if ($('.banner img').length){ $(".banner img:eq(0)").one('load', function() { isrun = true; conInit(); }).each(function() { if(this.complete){ $(this).load(); return false; }; }) }else{ isrun = true; conInit(); } }); $(window).scroll(function() { npos = $(window).scrollTop(); SW = $(window).width(); SH = $(window).height(); }); $(window).resize(function(){ SW = $(window).width(); SH = $(window).height(); }); function conInit(){ var Actions,Event,total; var cur = 0; var ncur = 0; var cTarget = $('body'); var item = []; if (cTarget.find('.maxbox').length == 0){ return false; } Init = { _start:function(){ total = cTarget.find('.maxbox').length; var _i = 0; cTarget.find('.maxbox').each(function($index){ var _t = $(this); item[$index] = { _data:_i, _target:_t, _moveFlag:true, _play:function(_posY){ var target = this._target; var f_t = target.position().top; var f_b = f_t+600; var p_y = _posY - f_t; var d_y; var target_w = target.width(); var target_h = target.height(); if(item[cur]._moveFlag){ var __i = 0; target.find('.TweenToDelayUp').each(function(){ var _d = __i*0.15 TweenMax.to($(this),0.8,{y:0,alpha:1,delay:_d,ease:Quad.easeOut}); __i++ }); target.find('.TweenToDelayUpChildren').children().each(function(){ var _d = __i*0.15 TweenMax.to($(this),0.8,{y:0,alpha:1,delay:_d,ease:Quad.easeOut}); __i++ }); target.find('.TweenToDelayDown').each(function(){ var _d = __i*0.15 TweenMax.to($(this),0.8,{y:0,alpha:1,delay:_d,ease:Quad.easeOut}); __i++ }); target.find('.TweenToShow').each(function(){ var _d = __i*0.15; TweenMax.to($(this),1.5,{y:0,alpha:1,delay:0,ease:Quad.easeOut}); __i++ }); target.find('.TweenToShowChildren').children().each(function(){ var _d = __i*0.15; TweenMax.to($(this),1.5,{y:0,alpha:1,delay:0,ease:Quad.easeOut}); __i++ }); target.find('.TweenToDelayShow').each(function(){ var _d = __i*0.15; TweenMax.to($(this),1.5,{y:0,alpha:1,delay:_d,ease:Quad.easeOut}); __i++ }); target.find('.TweenToDelayShowChildren').children().each(function(){ var _d = __i*0.15; TweenMax.to($(this),1.5,{y:0,alpha:1,delay:_d,ease:Quad.easeOut}); __i++ }); target.find('.TweenToLeft, .TweenToRight').each(function(){ var _d = __i*0.15; TweenMax.to($(this),1.5,{x:0,alpha:1,delay:0,ease:Quad.easeOut}); __i++ }); target.find('.TweenToLeftChildren, .TweenToRightChildren').children().each(function(){ var _d = __i*0.15; TweenMax.to($(this),1.5,{x:0,alpha:1,delay:0,ease:Quad.easeOut}); __i++ }); target.find('.TweenToDelayLeftChildren, .TweenToDelayRightChildren').children().each(function(){ var _d = __i*0.4;//console.log(__i); if (target.hasClass('oymc_div')){ if (__i % 2 > 0){ _d = old_d; } }else if (target.hasClass('TweenToUp')){ _d = 1.0; } TweenMax.to($(this),1.0,{x:0,alpha:1,delay:_d,ease:Quad.easeOut}); old_d = _d; __i++ }); target.find('.TweenScale').each(function(){ var _d = __i*0.15; TweenMax.to($(this),1.5,{scale:1.1,alpha:1,delay:0,ease:Quad.easeOut}); __i++ }); } this._moveFlag = false; }, _reset:function(){ var target = this._target; var target_w = target.width(); var target_h = target.height(); this._moveFlag = true target.find('.TweenToDelayUp').each(function(){ TweenMax.set($(this),{y:50,alpha:0}); }); target.find('.TweenToDelayUpChildren').children().each(function(){ TweenMax.set($(this),{y:50,alpha:0}); }); target.find('.TweenToDelayDown').each(function(){ TweenMax.set($(this),{y:-50,alpha:0}); }); target.find('.TweenToShow, .TweenToDelayShow').each(function(){ TweenMax.set($(this),{alpha:0}); }); target.find('.TweenToShowChildren, .TweenToDelayShowChildren').children().each(function(){ TweenMax.set($(this),{alpha:0}); }); target.find('.TweenToLeft, .TweenToDelayLeft').each(function(){ TweenMax.set($(this),{x:200,alpha:0}); }); target.find('.TweenToRight, .TweenToDelayRight').each(function(){ TweenMax.set($(this),{x:-200,alpha:0}); }); target.find('.TweenToLeftChildren, .TweenToDelayLeftChildren').children().each(function(){ TweenMax.set($(this),{x:200,alpha:0}); }); target.find('.TweenToRightChildren, .TweenToDelayRightChildren').children().each(function(){ TweenMax.set($(this),{x:-200,alpha:0}); }); } } item[$index]._reset(); _i++ }); item[cur]._play(npos); } }//init End Actions = { _pageMove:function(targetY){ $('html,body').stop().animate({scrollTop:targetY},1200) }, _pageHandler:function(_posY){ item[cur]._play(_posY); if(_posY == 0){ cTarget.find('.maxbox').each(function($index){ //item[$index]._reset(); }); //item[cur]._play(_posY); } }, _pageResize:function(){ cTarget.find('.maxbox').each(function($index){ //item[$index]._reset(); }); } }//Actions End Event = { _activeHandler:function(index){ var _mb = SH-(SH/2) cTarget.find('.maxbox').each(function(vi){ //console.log($(this).index('.maxbox')); if(vi != total-1){ if(index >= $(this).offset().top-_mb && index <= $(this).next().offset().top-_mb){ cur = vi; } if(index >= $(this).offset().top && index <= $(this).next().offset().top){ ncur = vi; } }else{ if(index >= $(this).offset().top-_mb){ cur = vi; } if(index >= $(this).offset().top){ ncur = vi; } } }); } }//Event End $(window).scroll(function() { npos = $(window).scrollTop(); SW = $(window).width(); SH = $(window).height(); Event._activeHandler(npos); Actions._pageHandler(npos); });//chd scroll $(window).resize(function(){ SW = $(window).width(); SH = $(window).height(); Actions._pageResize(); });//chd resize Init._start(); Event._activeHandler(npos); Actions._pageHandler(npos); }//conInit End $(window).resize(function () { if( ($(".productb").width() - ( $(".productc").width() + ( ($(window).width() - $(".container").width())/2 ) ))>0 ){ $("html").css("overflow-x","scroll"); }else{ $("html").css("overflow-x","visible"); } }); $(window).ready(function(){ if( ($(".productb").width() - ( $(".productc").width() + ( ($(window).width() - $(".container").width())/2 ) ))>0 ){ $("html").css("overflow-x","scroll"); }else{ $("html").css("overflow-x","visible"); } }); var windowHeight = $(window).height(),   $body = $("body");   // console.log($(window).height()); //627   // console.log($('body').height()); //0   $body.css("height", windowHeight); //重要代码 /*菜单产品栏目*/ $('.secondList li').each(function () { $(this).click(function () { var index = $(this).index(); $('.secondList li').removeClass('productActive'); $(this).addClass('productActive'); $('.secondListShows .secondListShow').removeClass('secondShowActive').eq(index).addClass('secondShowActive'); }) }) $('.secondMenu .mask').click(function(){ $('.secondMenu').slideUp() }) $('.menuClose').click(function () { $('.secondMenu').slideUp() }) $('#product').hover(function(){ $(this).find('.secondMenu').toggle() })