//banner $(function () { var $firstimg = $('.banner img').eq(0); if ($firstimg.length) { var img = new Image(); img.onload = function () { if ($firstimg.innerHeight() < 1) { $('.banner').css({'height': 'auto'}); } else { $('.banner').css({'height': $firstimg.innerHeight()}); } } img.src = $firstimg.attr("src"); setTimeout(function () { $('.banner').css({'height': 'auto'}); }, 8000); $(window).resize(function () { $('.banner').css({'height': 'auto'}); }); }else{ $('.banner').css({'height': 'auto'}); } }); /*鍗曢€夋*/ $(function () { $('.w-option').click(function () { $(this).siblings('.w-option').children('input').removeClass('checked'); $(this).children('input').addClass('checked'); }); }); /*澶嶉€夋*/ $(function () { $('input[type="checkbox"]').on('change', function () { $(this)[$(this).prop('checked') ? 'addClass' : 'removeClass']('checked'); }); }); /*閫夋嫨涓嬫媺妗?/ $(function () { var selects = $(".w-select-box"); var i; for (i = 0; i < selects.length; i++) { selects.eq(i).parent().parent().css({'z-index': 100 - i}); selects.eq(i).css({'z-index': 100 - i, 'position': 'relative'}); } $('.w-select-option').hide(); $('.w-select-box .w-select-dt').bind('click', function (e) { if ($(this).children('.select-icon').hasClass('select-down')) { $(this).children('.select-icon').removeClass('select-down'); $(this).parent().find('.w-select-option').slideUp(); e.stopPropagation(); } else { $(this).children('.select-icon').addClass('select-down'); $(this).parent().find('.w-select-option').slideDown(); e.stopPropagation(); } }) $("body").bind("click", function (e) { e = window.event || e; // 鍏煎IE7 obj = $(e.srcElement || e.target); if ($(obj).is(".w-select-box *")) { } else { $('.w-select-option').slideUp(); $('.w-select-dt').children('.select-icon').removeClass('select-down'); } }); $('.w-select-option div').click(function () { var itemContent = $(this).html(); $(this).parents('.w-select-dl').find('.w-select-dt .selected').html(itemContent).trigger("contentchanged"); $(this).parents('.w-select-dl').find('.w-select-option').slideUp(); $(this).parents('.w-select-dl').find('.w-select-dt').children('.select-icon').removeClass('select-down'); }); }); /*浼氬憳閫夋嫨涓嬫媺妗?/ $(function () { var selects = $(".select-box-gw"); var i; for (i = 0; i < selects.length; i++) { selects.eq(i).parent().parent().css({'z-index': 100 - i}); selects.eq(i).css({'z-index': 100 - i, 'position': 'relative'}); } $('.select-option-gw').hide(); $('.select-box-gw .select-dt-gw').bind('click', function (e) { if ($(this).data("select") === false) { return ''; } $(this).parent().find('.select-option-gw').slideDown(); e.stopPropagation(); $(this).parents('.select-dl-gw').find('.select-option-gw div').click(function () { var itemContent = $(this).html(); $(this).parents('.select-dl-gw').find('.select-dt-gw .selected').html(itemContent); $(this).parents('.select-dl-gw').find('.select-option-gw').slideUp(); }); }) $("body").bind("click", function (e) { e = window.event || e; // 鍏煎IE7 obj = $(e.srcElement || e.target); if ($(obj).is(".select-box-gw *")) { } else { $('.select-option-gw').slideUp(); } }); }); /*tab鍒囨崲*/ $(function () { $(".info_tab li[data-tab]").click(function () { $(this).siblings().removeClass('cur_tab'); $(this).addClass('cur_tab'); var data = $(this).attr('data-tab'); $("div[id^='Tabitem']").hide(); $("#Tabitem" + data).show(); }); }); /*鏀惰棌婊氬姩*/ $(function () { var conBoxChild = $('.collect_listA').html(); var slideC = function () { var visC; if ($(window).width() > 960) { visC = 5; } else if ($(window).width() > 767) { visC = 4; } else { visC = 3; } if($(".myCollectA").is(':visible')){ $(".myCollectA").slideNew({ mainCell: ".collect_listA ul", autoPage: false, effect: "leftLoop", autoPlay: true, scroll: 1, vis: visC, prevCell: ".slide_lA", nextCell: ".slide_rA" }); } } slideC(); var widthOld=$(window).width(); var widthNew; $(window).resize(function () { widthNew=$(window).width(); if(widthOld > 960){ if(widthNew < 960){ $('.collect_listA').html(conBoxChild); slideC(); } }else if(widthOld > 768){ if(widthNew < 768){ $('.collect_listA').html(conBoxChild); slideC(); }else if(widthNew > 960){ $('.collect_listA').html(conBoxChild); slideC(); } }else{ if(widthNew > 768){ $('.collect_listA').html(conBoxChild); slideC(); } } widthOld=$(window).width(); }); }); /*鏂伴椈缁勪欢3鐨勫彸杈瑰浘鐗囧ぇ灏忚嚜閫傚簲*/ /*鍥剧墖浣嶇疆璁$畻*/ var imgCount = function () { $('.img-count').each(function (index, element) { var imgH = $(this).height(); var imgW = $(this).width(); var $thisimg = $(this).find('img'); var img = new Image(); img.onload = function () { if ($thisimg.data("img") === false) { return ''; } if ($thisimg.data("img") === 'AutoImageSize') { $.AutoImageSize($thisimg); return ''; } if ($thisimg.data("img") === 'AutoProductImgSize') { $.AutoProductImgSize($thisimg); return ''; } var imgWidth = img.width; var imgHeight = img.height; if ($thisimg.data("img") === 'AllImgSize') { if (imgWidth <= imgW && imgHeight <= imgH) { widthThan = 'auto'; heightThan = 'auto'; leftThan = (((imgW - imgWidth) / 2) / imgW) * 100; topThan = (((imgH - imgHeight) / 2) / imgH) * 100; } else { if (imgHeight > imgH) { imgWidth = (imgH / imgHeight) * imgWidth; imgHeight = imgH; } if (imgWidth > imgW) { imgHeight = (imgW / imgWidth) * imgHeight; imgWidth = imgW; } widthThan = ((imgWidth / imgW) * 100) + '%'; heightThan = ((imgHeight / imgH) * 100) + '%'; leftThan = (((imgW - imgWidth) / 2) / imgW) * 100; topThan = (((imgH - imgHeight) / 2) / imgH) * 100; } $thisimg.css({'position':'absolute', 'width': widthThan, 'height': heightThan, 'left': leftThan + '%', 'top': topThan + '%' }); return ''; } if ((imgWidth / imgHeight) < (imgW / imgH)) { $thisimg.css({'height': (imgW / imgH) * ((imgHeight * 1.00) / imgWidth) * imgH, 'max-height': (imgW / imgH) * ((imgHeight * 1.00) / imgWidth) * imgH, 'top': -((imgW / imgH) * ((imgHeight * 1.00) / imgWidth) - 1) / 2 * imgH, 'width': '100%', 'max-width': '100%', 'left': 0}) } else { $thisimg.css({'width': (imgH / imgW) * ((imgWidth * 1.00) / imgHeight) * imgW, 'max-width': (imgH / imgW) * ((imgWidth * 1.00) / imgHeight) * imgW, 'left': -((imgH / imgW) * ((imgWidth * 1.00) / imgHeight) - 1) / 2 * imgW, 'height': '', 'max-height': '', 'top': 0}) } } var thisimg_src = $thisimg.attr("src"); if(typeof(thisimg_src) != 'undefined'){ img.src = $thisimg.attr("src"); } }); } $(function () { var xxH = false; var adimgwh = function () { var $adnews = $('.w-adNews3'); for (var i = 0; i < $adnews.length; i++) { var adimgw = $adnews.eq(i).find('.w-adNews-imgs').width(); var adimgh = $adnews.eq(i).find('.w-adNews-texts').height(); if($adnews.eq(i).find('.news-img .aspectRatio').attr('style')==null || xxH){ $adnews.eq(i).find('.news-img .aspectRatio').css('padding-bottom', (adimgh * 1.0 / adimgw) * 100 + '%'); xxH = true; } } } adimgwh(); imgCount(); var time = 0; var interval = setInterval(function () { imgCount(); if (time++ > 50) { clearInterval(interval); } }, 100); $(window).resize(function () { if(xxH){adimgwh();} imgCount(); }); }); //palceholder $(function () { // 鍒ゆ柇娴忚鍣ㄦ槸鍚︽槸IE7 if (navigator.appName == "Microsoft Internet Explorer" && navigator.appVersion.split(";")[1].replace(/[ ]/g, "") == "MSIE7.0") { if ($(".w-prd-imgbox>a").length > 0 && $(".w-prd-imgbox>a").find("img").length > 0) { $(".w-prd-imgbox>a").find("img").css("cursor", "pointer").click(function () { $(this).parents("a").children().click(); }); } if ($(".news-imgbox>a").length > 0 && $(".news-imgbox>a").find("img").length > 0) { $(".news-imgbox>a").find("img").css("cursor", "pointer").click(function () { $(this).parents("a").children().click(); }); } } //鍒ゆ柇娴忚鍣ㄦ槸鍚︽敮鎸乸laceholder灞炴€ supportPlaceholder = 'placeholder'in document.createElement('input'), placeholder = function (input) { var text = input.attr('placeholder'); var defaultValue = input.val(); if (!defaultValue) { if ($.trim(input.attr("type")) === "password") { input.hide(); var inputpassHtml = ''; input.parent("div").append(inputpassHtml); input.parent().children(".g-text-password").focus(function () { $(this).hide(); input.show().focus(); }); input.blur(function () { if ($.trim($(this).val()) == text || $.trim($(this).val()) == "") { $(this).hide(); input.parent().children(".g-text-password").show(); } }); } else { input.val(text).addClass("phcolor"); input.focus(function () { if (input.val() == text) { $(this).val(""); } }); input.blur(function () { if (input.val() == "") { $(this).val(text).addClass("phcolor"); } }); //杈撳叆鐨勫瓧绗︿笉涓虹伆鑹 input.keydown(function () { $(this).removeClass("phcolor"); }); } } }; //褰撴祻瑙堝櫒涓嶆敮鎸乸laceholder灞炴€ф椂锛岃皟鐢╬laceholder鍑芥暟 if (!supportPlaceholder) { $('input').each(function () { text = $(this).attr("placeholder"); if ($(this).attr("type") == "text" || $(this).attr("type") == "tel" || $(this).attr("type") == "email" || $(this).attr("type") == "password") { placeholder($(this)); } }); } }); $(function () { $('.w-adNews4').each(function(index, element) { if($(this).find('.date').is(':visible')){ }else{ $(this).addClass('w-adNews4-nodate'); } }); }); //鏂囩珷骞垮憡7绉诲叆鑳屾櫙棰滆壊鍙樺寲 $(function () { var adNewsLH; $('.w-adNews7 .adNewsL li').hover(function () { $(this).find('.date').addClass('bg_main'); $(this).find('.triangle-bottomright').addClass('border_colorbottom_main'); }, function () { $(this).find('.date').removeClass('bg_main'); $(this).find('.triangle-bottomright').removeClass('border_colorbottom_main'); }); $('.w-adNews7').each(function (index, element) { adNewsLH = $(this).find('.adNewsL').height() - parseInt($(this).find('.adNewsL li').css('margin-bottom')); if ($(window).width() > 767) { $(this).find('.adNewsR').css({"min-height": adNewsLH}); } }); $(window).resize(function () { $('.w-adNews7').each(function (index, element) { if ($(window).width() > 767) { adNewsLH = $(this).find('.adNewsL').height() - parseInt($(this).find('.adNewsL li').css('margin-bottom')); $(this).find('.adNewsR').css({"min-height": adNewsLH}); } else { $(this).find('.adNewsR').removeAttr("style"); } }); }) }); //鏂囩珷骞垮憡绉诲叆鑳屾櫙棰滆壊鍙樺寲 $(function () { $('.w-adNews16 li .news-item').hover(function () { $(this).find('.adnew_mask').addClass('bg_main'); }, function () { $(this).find('.adnew_mask').removeClass('bg_main'); }); }); //绯荤粺鑿滃崟瀵艰埅鎵嬫満鏄剧ず闅愯棌 $(function(){ if($(window).width()<768){ $('.systitle').bind('click',function(){ if($(this).hasClass('open')){ $(this).removeClass('open'); $(this).siblings('.ul-parent').slideUp(); $(this).siblings('.ul-parent').find('.ul-submenu').slideUp(); $(this).siblings('.ul-parent').find('.open').removeClass('open'); }else{ $(this).addClass('open'); $(this).siblings('.ul-parent').slideDown(); } }); } var oldWidth=$(window).width(); $(window).resize(function(){ var newWidth=$(window).width(); if(oldWidth>767){ if(newWidth<768){ $('.systitle').siblings('.ul-parent').slideUp(); $('.systitle').bind('click',function(){ if($(this).hasClass('open')){ $(this).removeClass('open'); $(this).siblings('.ul-parent').slideUp(); $(this).siblings('.ul-parent').find('.ul-submenu').slideUp(); $(this).siblings('.ul-parent').find('.open').removeClass('open'); }else{ $(this).addClass('open'); $(this).siblings('.ul-parent').slideDown(); } }); } }else{ if(newWidth>768){ $('.systitle').unbind('click'); $('.systitle').removeClass('open'); $('.systitle').siblings('.ul-parent').slideDown(); $('.systitle').siblings('.ul-parent').find('.ul-submenu').removeAttr('style'); $('.systitle').siblings('.ul-parent').find('.open').removeClass('open'); } } oldWidth=$(window).width(); }); }); //绯荤粺鍒嗙被3浜岀骇 $(function(){ var mlW=0; var mlC=function(){ $('.w-com-menu-H2 > .w-com-menu-in > .ul-parent > .li-parent > .div-parent').each(function(index, element) { if($(this).innerWidth()>mlW){ mlW=$(this).innerWidth(); } }); } $('.w-com-menu-H2 a').each(function(index, element) { if($(this).closest('li').hasClass('cur')){ $(this).addClass('colorbg_main'); }else{ $(this).hover(function(){ $(this).addClass('colorbg_main'); },function(){ $(this).removeClass('colorbg_main'); }); } }); if($(window).width()>767){ mlC(); $('.w-com-menu-H2 > .w-com-menu-in > .ul-parent > .li-parent > .div-parent').css({'width':mlW+3}); $('.w-com-menu-H2 .ul-submenu').css({'margin-left':mlW+20}); } var oldWidth=$(window).width(); $(window).resize(function(){ var newWidth=$(window).innerWidth(); if(oldWidth>767){ if(newWidth<768){ $('.w-com-menu-H2 > .w-com-menu-in > .ul-parent > .li-parent > .div-parent').removeAttr("style"); $('.w-com-menu-H2 .ul-submenu').removeAttr("style"); } }else{ if(newWidth>768){ mlW=0; mlC(); $('.w-com-menu-H2 > .w-com-menu-in > .ul-parent > .li-parent > .div-parent').css({'width':mlW+3}); var mulL=function(){ $('.w-com-menu-H2 .ul-submenu').css({'margin-left':mlW+20}); } setTimeout(mulL,500); } } oldWidth=$(window).width(); }); }); //faq3鐐瑰嚮缂╂斁 $(function(){ $('.w-faq-list3 li .faq_tit').addClass('faq_tit3bg'); $('.w-faq-list3 li').eq(0).addClass('open'); $('.w-faq-list3 li').eq(0).find('.faq_tit').addClass('bg_main'); $('.w-faq-list3 li').eq(0).find('.faq_det').slideDown(); $('.w-faq-list3 li .faq_tit').click(function(){ $(this).parents('li').siblings('li').removeClass('open'); $(this).parents('li').siblings('li').find('.faq_tit').removeClass('bg_main'); $(this).parents('li').siblings('li').find('.faq_det').slideUp(); if($(this).parents('li').hasClass('open')){ $(this).parents('li').removeClass('open'); $(this).siblings('.faq_det').slideUp(); $(this).removeClass('bg_main'); }else{ $(this).parents('li').addClass('open'); $(this).siblings('.faq_det').slideDown(); $(this).addClass('bg_main'); } }); }); //鎵嬫満婊氬姩鍒伴《閮 $(function(){ if($(window).scrollTop()>10){ if($(window).width()<960){ $('.topTel').show(); } } $(window).scroll(function(){ if($(window).width()<960){ if($(window).scrollTop()>10){ $('.topTel').show(); }else{ $('.topTel').hide(); } } }) }); //浜у搧璇︽儏 $(function(){ $('.product-detail-info .product-short-sum').each(function(){ if($.trim($(this).html()) === ''){ $(this).remove(); }else{ if($(this).innerHeight()<25){ $(this).remove(); } } }) $('.product-detail-info .prd_detInfo_con').each(function(){ if($.trim($(this).html()) === ''){ $(this).remove(); }else{ if($(this).height()<16){ $(this).remove(); } } }) }) $(function () { $('.w-button25 .btn-w').on('mouseenter', function (e) { var parentOffset = $(this).offset(), relX = e.pageX - parentOffset.left, relY = e.pageY - parentOffset.top; $(this).find('.bgsqr1').css({ top: relY, left: relX }); }).on('mouseout', function (e) { var parentOffset = $(this).offset(), relX = e.pageX - parentOffset.left, relY = e.pageY - parentOffset.top; $(this).find('.bgsqr1').css({ top: relY, left: relX }); }); }); // 璇█涓嬫媺 $(function () { let firstClick = true; var langPosition = function(){ $('.w-languege-dropDown').each(function () { let leftLang = $(this).offset().left; let topLang = $(this).offset().top - $(window).scrollTop(); let $selectLang = $(this).find('.select-lang'); let widLang = $selectLang.innerWidth(); let widWindow = $(window).innerWidth(); let HghLang = $selectLang.innerHeight(); let HghWindow = $(window).innerHeight(); if (leftLang && widLang && leftLang + widLang + 20 > widWindow) { $selectLang.css({'right':'-15px', 'left':'auto'}) } if (topLang && HghLang && topLang + HghLang + 30 > HghWindow) { $selectLang.css({'top':'auto', 'bottom': '100%'}) } }) } langPosition(); $('.mobile-nav-toggle').click(function () { let setTimeoutLang; if (firstClick) { setTimeoutLang = setTimeout(function () { langPosition(); }, 1000); firstClick = false; } else { if (setTimeoutLang) { clearTimeout(setTimeoutLang) } } }) })