$(function(){ function toggleBackTop(t){ if($(window).scrollTop()>100){ $('.backTop').addClass('over'); }else{ $('.backTop').removeClass('over'); } if($(window).width()>750 ){ if($(window).scrollTop()>300){ $('.header').addClass('over') }else{ $('.header').removeClass('over') } } } $('#burger').click(function(){ $(this).toggleClass('on'); $('.m-header').toggleClass('over') $('.pageBox').toggleClass('out') }) $('.m-header-layer').click(function(){ $('#burger').removeClass('on'); $('.m-header').removeClass('over') $('.pageBox').removeClass('out') }) $(window).scroll(function(){ toggleBackTop(); }) toggleBackTop(); // 鎴彇about椤甸潰鐨刪ash $('body').addClass('isLoaded') $('.openLayVideo').click(function(){ var ovideo = $(this).data('video'); var oiframe= $(this).data('iframe') if(oiframe){ showIframeVideoLayer(oiframe) }else{ showVideoLayer(ovideo) } return false; }) if($('.hm-banner').length){ $(window).scroll(function(){ if($(window).scrollTop()>100){ $('.header,.toper').addClass('vblack') }else{ $('.header,.toper').removeClass('vblack') } }) }else{ $('.header,.toper').addClass('vblack') } navshover('.header .hh-menus dt a'); navshover2('.secNav a') navshover3('.m-header .hh-menus dt a'); $('.fdMenus').each(function(){ $(this).find('.secNav a:not(.wap-show)').first().trigger('mouseover') }) $('.hh-search a').click(function(e){ $('.header .search-box').fadeToggle() }) $('.header .hh-search').click(function(e){ e.stopPropagation() }) $('body').click(function(){ $('.header .search-box').fadeOut() }) $('.product-c-nav dt a').click(function(){ var odl = $(this).closest('dl') $(this).toggleClass('on') odl.find('dd').slideToggle() odl.siblings('dl').find('dt a').removeClass('on') odl.siblings('dl').find('dd').slideUp() }) $('.ft-share a, .toper .ashare a').click(function(){ var codeImg = $(this).data('code') if(codeImg){ var desc = $(this).data('description') showCodeLayer(codeImg,desc) return false; } }) pendantFixed($('.com-widgets .fix-widgets')) }) function pendantFixed(obj){ if(obj.length && !isMobile()){ var rh = obj.offset().top, rl = obj.position().left, rw = obj.outerWidth(true); $(document).scroll(function(){ var objh = obj.outerHeight(true) var outTopHeight = $('.toper').height() + $('.header').height() var vdis = $(window).scrollTop() > (rh-outTopHeight); if(vdis){ obj.addClass('fixeds') if($(window).scrollTop() < ($('.footer').offset().top-objh-outTopHeight-80)){ obj.css({ top: $(window).scrollTop()-rh+outTopHeight+10, left:rl }) } }else{ obj.removeClass('fixeds') } }) } } // 鍒ゆ柇鏄惁鎵嬫満娴忚鍣 function isMobile(){ return $(window).width()<=750 } function isIE9(){ if(navigator.appName == "Microsoft Internet Explorer"&&parseInt(navigator.appVersion.split(";")[1].replace(/[ ]/g, "").replace("MSIE",""))<=9){ return true; } return false; } ;(function($){ $.fn.serializeJson=function(){ var serializeObj={}; var array=this.serializeArray(); var str=this.serialize(); $(array).each(function(){ if(serializeObj[this.name]){ if($.isArray(serializeObj[this.name])){ serializeObj[this.name].push(this.value); }else{ serializeObj[this.name]=[serializeObj[this.name],this.value]; } }else{ serializeObj[this.name]=this.value; } }); return serializeObj; }; $.fn.customPage = function(options){ var config = { initPage:1, size:5, prevBtn:'.page-prev', nextBtn:'.page-next', callback:function(){} } var opt = $.extend(config,options); var size = opt.size; var _this = $(this); var listObj = $(this).children(); var totalSize = listObj.length; var totalPage = Math.ceil(totalSize/size); var prevBtn = $(opt.prevBtn), nextBtn = $(opt.nextBtn); var actPage = totalPage ? opt.initPage : 0; function changePage(){ var actList = listObj.slice((actPage-1)*size, actPage*size) _this.html(actList) opt.callback({ actPage:actPage, totalPage:totalPage }) } changePage(); _this.show(); prevBtn.click(function(){ if(actPage == 1){ return false; } --actPage; changePage() }) nextBtn.click(function(){ if(actPage == totalPage){ return false; } ++actPage; console.log(actPage) changePage() }) } })(jQuery); function CheckUrl(str) { var RegUrl = new RegExp(); RegUrl.compile("^[A-Za-z]+://[A-Za-z0-9-_]+\\.[A-Za-z0-9-_%&\?\/.=]+$"); if (!RegUrl.test(str)) { return false; } return true; } // 瑙嗛鎾斁 function showVideoLayer(ohtml){ if(!ohtml){ layer.msg('Url is error...') return false; } if(CheckUrl(ohtml)){ var xshowbox = '
'; }else{ var xshowbox = '
'+ohtml+'
'; } layer.open({ type:1, shade: 0.7, title: false, //涓嶆樉绀烘爣棰 area:[isMobile() ? '90vw' : '800px',isMobile() ? '60vw' : '500px'], content: xshowbox, }) } // 澶栭摼瑙嗛鎾斁 function showIframeVideoLayer(ohtml){ var oiframe = decodeURIComponent(ohtml) var xshowbox = '
'+oiframe+'
'; layer.open({ type:1, shade: 0.7, title: false, //涓嶆樉绀烘爣棰 area:[isMobile() ? '320px' : '800px'], content: xshowbox, }) } function navshover(nav,time){ //瑙﹀彂鐨勬寜閽紝寮瑰嚭鐨勫唴瀹癸紝寤惰繜鐨勬椂闂 var menuShow,menuHide; var dtime=time || 100; //寤惰繜瑙﹀彂鏃堕棿 var o_nav=$(nav); o_nav.hover(function(){ var _this=$(this); var openid=_this.data('menu'); if(!openid){ return; } clearTimeout(menuHide); clearTimeout(menuShow); menuShow=setTimeout(function(){ $("#"+openid).stop().slideDown(150); $('.faMenus,.fdMenus').not('#'+openid).hide() },dtime); },function(){ clearTimeout(menuHide); clearTimeout(menuShow); var _this=$(this); var openid=_this.data('menu'); menuHide=setTimeout(function(){ $("#"+openid).hide(); },dtime); }) $('.faMenus,.fdMenus').hover(function(){ clearTimeout(menuHide); },function(){ var _this = $(this); menuHide=setTimeout(function(){ _this.hide(); },dtime); }) } // 鑿滃崟 function navshover2(nav){ //瑙﹀彂鐨勬寜閽紝寮瑰嚭鐨勫唴瀹癸紝寤惰繜鐨勬椂闂 var menuShow,menuHide; var o_nav=$(nav); o_nav.hover(function(){ var _this=$(this); var wrap = _this.closest('.fdMenus') var openid=_this.data('menu'); _this.addClass('active').siblings().removeClass('active'); if(openid){ $("#"+openid).show().siblings().hide() }else{ wrap.find('.tnavs').hide(); } var aimg = _this.data('img') || 'none', atit = _this.data('text') || '', ahref = _this.attr('href') || ''; wrap.find('.secPhoto .img').css({ 'background-image': 'url('+aimg+')' }) wrap.find('.secPhoto .tit').text(atit); wrap.find('.secPhoto a').attr(ahref) },function(){ }) } // 鑿滃崟 function navshover3(nav){ //瑙﹀彂鐨勬寜閽紝寮瑰嚭鐨勫唴瀹癸紝寤惰繜鐨勬椂闂 var menuShow,menuHide; var o_nav=$(nav); o_nav.click(function(){ var _this=$(this); // var wrap = _this.closest('.fdMenus') var openid=_this.data('menu'); _this.addClass('active').siblings().removeClass('active'); if(openid){ $('.full-menus').show() $('#burger').click() $("#"+openid).show().siblings().hide() $('.fdMenus').not('#'+openid).hide() return false; } }) $('.full-menus').click(function(){ //$('.fdMenus').hide() //$('.full-menus').hide() }) $('.fdMenus').click(function(e){ e.stopPropagation() }) } // 鎵撳紑寰俊浜岀淮鐮 function showCodeLayer(codeImg,desc){ if(!codeImg){ return false; } var xshowbox = '

'+desc+'

'; layer.open({ type:1, shade: 0.7, title: false, //涓嶆樉绀烘爣棰 area:[isMobile() ? '90vw' : '320px',isMobile() ? '60vw' : '400px'], content: xshowbox, }) }