1/*Swiper Banner*/ 2if ($('.swiper-wrapper .swiper-slide').length < 2) { 3 $('.swiper-pagination').hide() 4} 5var mySwiper = new Swiper('.slider_banner', { 6 effect: 'fade', 7 speed: 1000, 8 loop: true, 9 autoplay: { 10 delay: 4500, 11 disableOnInteraction: false, 12 }, 13 pagination: { 14 el: '.slider_banner .swiper-pagination', 15 clickable: true 16 }, 17 navigation: { 18 nextEl: '.slider_banner .swiper-button-next', 19 prevEl: '.slider_banner .swiper-button-prev', 20 }, 21 on: { 22 init: function () { 23 var _that = this; 24 setCurPage('.slider_banner', _that) 25 } 26 } 27}); 28 29 30mySwiper.on('slideChange', function () { 31 setCurPage('.slider_banner', mySwiper) 32}); 33 34function setCurPage(sliderWrap, ele) { 35 var curIndex = ele.realIndex + 1; 36 var total = ele.slides.length - 2; 37 var curHtml = '<i class="cur">' + curIndex + '</i>' + '<b class="line">/</b>' + '<i class="total">' + total + '</i>'; 38 $(sliderWrap).find('.slide-page-box').html(curHtml); 39} 40 41 42var swiper = new Swiper('.image-additional', { 43 slidesPerView: 3, 44 spaceBetween: 0, 45 watchOverflow: true, 46 pagination: { 47 el: '.product-view .swiper-pagination', 48 clickable: true, 49 }, 50 navigation: { 51 nextEl: '.product-view .swiper-button-next', 52 prevEl: '.product-view .swiper-button-prev', 53 }, 54 breakpoints: { 55 1366: { 56 slidesPerView: 3 57 }, 58 950: { 59 slidesPerView: 3 60 }, 61 480: { 62 slidesPerView: 1, 63 loop: true 64 } 65 } 66}) 67 68 69var relatedSwiper = new Swiper('.goods-may-like .swiper-slider', { 70 slidesPerView: 4, 71 spaceBetween: 0, 72 speed: 400, 73 watchOverflow: true, 74 navigation: { 75 nextEl: '.goods-may-like .swiper-button-next', 76 prevEl: '.goods-may-like .swiper-button-prev', 77 }, 78 pagination: { 79 el: '.goods-may-like .swiper-pagination', 80 clickable: true, 81 }, 82 breakpoints: { 83 1680: { 84 slidesPerView: 4 85 }, 86 1024: { 87 slidesPerView: 3 88 }, 89 768: { 90 slidesPerView: 2 91 }, 92 480: { 93 slidesPerView: 2, 94 slidesPerGroup: 2, 95 loop: true 96 } 97 } 98}); 99 100 101$('.head_nav li').each(function () { 102 if ($(this).find('ul').length > 0) { 103 $(this).children('a').append("<b></b>"); 104 $(this).addClass('has-child'); 105 } 106}) 107// Navigation dropdown menu 108dropMenu('.head_nav li', 'ul', 0, 'menu_show'); 109 110tabContainer('.tab-content-wrap', '.tab-title', '.tab-panel'); 111 112function hideMsgPop() { 113 $('.inquiry-pop-bd').fadeOut('fast'); 114 $('div#customer-chat-widget').remove(); 115} 116 117if ($('body .inquiry-form-wrap').length > 0) { 118 var webTop = $('body .inquiry-form-wrap').offset().top - 80 119 $('.product-btn-wrap .email,.company_subscribe .button,.side_content .side_list .email').click(function () { 120 $("html, body").animate({scrollTop: webTop}, 1000); 121 $(".ad_prompt").show().delay(3000).hide(300); 122 }) 123} else { 124 $('.product-btn-wrap .email,.company_subscribe .button,.side_content .side_list .email').click(function () { 125 $('.inquiry-pop-bd').fadeIn('fast') 126 }) 127} 128$('.inquiry-pop,.product-btn-wrap .email,.company_subscribe .button,.side_content .side_list .email').click(function (e) { 129 e.stopPropagation(); 130}) 131$(document).click(function () { 132 hideMsgPop(); 133}) 134 135function changeuRL(link) { 136 var curUrl = document.location.href; 137 var oldUrl = window.location.host + '/'; 138 var lgArr = ['fr/', 'de/', 'pt/', 'es/', 'ru/', 'ko/', 'ar/', 'ga/', 'ja/', 'el/', 'tr/', 'it/', 'da/', 'ro/', 'id/', 'cs/', 'af/', 'sv/', 'pl/', 'eu/', 'ca/', 'eo/', 'hi/', 'lo/', 'sq/', 'am/', 'hy/', 'az/', 'be/', 'bn/', 'bs/', 'bg/', 'ceb/', 'ny/', 'co/', 'hr/', 'nl/', 'et/', 'tl/', 'fi/', 'fy/', 'gl/', 'ka/', 'gu/', 'ht/', 'ha/', 'haw/', 'iw/', 'hmn/', 'hu/', 'is/', 'ig/', 'jw/', 'kn/', 'kk/', 'km/', 'ku/', 'ky/', 'la/', 'lv/', 'lt/', 'lb/', 'mk/', 'mg/', 'ms/', 'ml/', 'mt/', 'mi/', 'mr/', 'mn/', 'my/', 'ne/', 'no/', 'ps/', 'fa/', 'pa/', 'sr/', 'st/', 'si/', 'sk/', 'sl/', 's
138o/', 'sm/', 'gd/', 'sn/', 'sd/', 'su/', 'sw/', 'tg/', 'ta/', 'te/', 'th/', 'uk/', 'ur/', 'uz/', 'vi/', 'cy/', 'xh/', 'yi/', 'yo/', 'zu/', 'zh-CN/', 'zh-TW/']; 139 $.each(lgArr, function (i, lenItem) { 140 var lgUrl = oldUrl.toString() + lenItem; 141 if (curUrl.indexOf(lgUrl) != -1) { 142 link.each(function (i) { 143 if (!$(this).parents().hasClass('language-flag')) { 144 var iLink; 145 if ($(this).prop('href')) { 146 iLink = $(this).prop('href'); 147 } 148 if (String(iLink).indexOf(oldUrl) != -1 && String(iLink).indexOf(lgUrl) == -1 && curUrl.indexOf(lgUrl) != -1) { 149 var newLink = iLink.replace(oldUrl, lgUrl); 150 $(this).attr('href', newLink); 151 } 152 } 153 }) 154 } 155 }); 156} 157 158$(function () { 159 changeuRL($('a')); 160}) 161$(document).ready(function () { 162 $('.change-language .change-language-cont').append("<div class='change-empty'>Untranslated</div>") 163 $('.prisna-wp-translate-seo').append("<div class='lang-more'>More Language</div>") 164 if ($('body .prisna-wp-translate-seo').length > 0 && $('.change-language .prisna-wp-translate-seo').length < 1) { 165 $('.prisna-wp-translate-seo').appendTo('.change-language .change-language-cont') 166 if ($('.change-language .change-language-cont .prisna-wp-translate-seo li').length > 0) { 167 $('.change-language .change-language-cont .change-empty').hide() 168 $('.change-language .change-language-cont .prisna-wp-translate-seo li').each(function (index) { 169 if (index > 35) { 170 $(this).addClass('lang-item lang-item-hide') 171 $('.change-language-cont').find('.lang-more').fadeIn() 172 } else { 173 $('.change-language-cont').find('.lang-more').fadeOut() 174 } 175 }) 176 if ($('.change-language-cont .lang-more').length > 0) { 177 $('.change-language-cont .lang-more').click(function () { 178 if ($(this).parents('.change-language-cont').find('.prisna-wp-translate-seo li.lang-item').hasClass('lang-item-hide')) { 179 $(this).parents('.change-language-cont').find('.prisna-wp-translate-seo li.lang-item').removeClass('lang-item-hide') 180 $(this).addClass('more-active').text('x') 181 } else { 182 $(this).parents('.change-language-cont').find('.prisna-wp-translate-seo li.lang-item').addClass('lang-item-hide') 183 $(this).removeClass('more-active').text('More Language') 184 } 185 }) 186 } 187 } else { 188 $('.change-language .change-language-cont .change-empty').fadeIn() 189 } 190 } 191}) 192 193 194// get window size 195var winWidth = 0; 196var winHeight = 0; 197 198function getWinSize() { 199 if (window.innerWidth) { 200 winWidth = window.innerWidth; 201 } else if ((document.body) && (document.body.clientWidth)) { 202 winWidth = document.body.clientWidth; 203 } 204 if (window.innerHeight) { 205 winHeight = window.innerHeight; 206 } else if ((document.body) && (document.body.clientHeight)) { 207 winHeight = document.body.clientHeight; 208 } 209 if (document.documentElement && document.documentElement.clientHeight && document.documentElement.clientWidth) { 210 if (window.innerWidth && window.innerHeight) { 211 winWidth = window.innerWidth; 212 winHeight = window.innerHeight; 213 } else { 214 winHeight = document.documentElement.clientHeight; 215 winWidth = document.documentElement.clientWidth; 216 } 217 } 218} 219 220getWinSize(); 221 222$(function () { 223 var $nav = $('.web_head'), 224 navTop = $('.nav_wrap').offset().top, 225 headH = $nav.outerHeight(), 226 winTop_1 = 0, 227 spr = $('body').height() - $nav.height(), 228 holder = jQuery('<div class="head_holder">'); 229 230 function fixedTop() { 231 var winTop_2 = $(window).scrollTop(); 232 holder.css('height', $('.nav_wrap').outerHeight()); 233 if (winTop_2 > headH && winWidth >= 950) { 234 holder.show().appendTo($nav); 235 $nav.addClass('fixed-nav'); 236 $nav.parents('body').addClass('fixed-body'); 237 setTimeout(function () { 238 $nav.addClass('fixed-nav-active') 239 }); 240 } else { 241 holder.hide(); 242 $nav.removeClass('fixed-nav fixed-nav-active'); 243 $nav.parents('body').removeClass('fixed-body'); 244 } 245 if (winTop_2 > winTop_1 && winWidth >= 950) { 246 $nav.removeClass('fixed-nav-appear'); 247 } else if (winTop_2 < winTop_1) { 248 $nav.addClass('fixed-nav-appear'); 249 } 250 winTop_1 = $(window).scrollTop(); 251 } 252 253 fixedTop(); 254 $(window).on('scroll', function () { 255 fixedTop(); 256 }) 257 $(window).on('resize', function () { 258 fixedTop(); 259 }) 260 261 262}) 263 264 265$('.faq-item').each(function (index) { 266 var _this = $(this) 267 var title = _this.find('.faq-title') 268 var cont = _this.find('.faq-cont') 269 if (index == 0) { 270 title.addClass('show-title') 271 } 272 title.on('click', function () { 273 if (cont.is(':hidden') && !$(this).hasClass('show-title')) { 274 cont.slideDown('fast') 275 $(this).addClass('show-title') 276 _this.siblings().find('.faq-title').removeClass('show-title') 277 _this.siblings().find('.faq-cont').slideUp('fast') 278 } else { 279 cont.slideUp('fast') 280 $(this).removeClass('show-title') 281 } 282 }) 283}) 284 285function mSizeChange() { 286 getWinSize(); 287 if (winWidth <= 950) { 288 if ($('.mobile-head-items').length < 1) { 289 var mobileService = '<div class="mobile-head-items"><div class="mobile-head-item mobile-head-nav"><div class="title"></div><div class="main-content-wrap side-content-wrap"><div class="content-wrap"></div></div></div><div class="mobile-head-item mobile-head-language"><div class="title"></div><div class="main-content-wrap side-content-wrap"><div class="content-wrap"></div></div></div><div class="mobile-head-item mobile-head-search"><div class="title"></div><div class="main-content-wrap middle-content-wrap"><div class="content-wrap"></div></div></div>' 290 $('body').append(mobileService) 291 if ($('body .aside').length > 0) { 292 $('.mobile-head-items').append('<div class="mobile-head-item mobile-head-aside"><div class="title"></div><div class="main-content-wrap side-content-wrap"><div class="content-wrap"></div></div></div>') 293 } 294 $('.mobile-head-item').each(function () { 295 $(this).find('.title').click(function () { 296 if ($(this).parents('.mobile-head-item').find('.main-content-wrap').length > 0) { 297 var pItem = $(this).parents('.mobile-head-item') 298 if (!pItem.find('.main-content-wrap').hasClass('show-content-wrap')) { 299 pItem.find('.main-content-wrap').addClass('show-content-wrap') 300 pItem.find('.side-content-wrap').stop().animate({'left': '0'}, 300) 301 pItem.find('.middle-content-wrap').addClass('middle-show-content-wrap') 302 pItem.find('.side-content-wrap').append("<b class='mobile-ico-close'></b>") 303 pItem.siblings('.mobile-head-item').find('.main-content-wrap').removeClass('show-content-wrap') 304 pItem.siblings('.mobile-head-item').find('.side-content-wrap').stop().animate({'left': '-70%'}, 300) 305 pItem.siblings('.mobile-head-item').find('.middle-content-wrap').removeClass('middle-show-content-wrap') 306 pItem.siblings('.mobile-head-item').find('.side-content-wrap .mobile-ico-close').remove() 307 if ($('.mobile-head-items').find('.mobile-body-mask').length < 1) { 308 $('.mobile-head-items').append('<div class="mobile-body-mask"></div>') 309 } 310 } else { 311 pItem.find('.main-content-wrap').removeClass('show-content-wrap') 312 pItem.find('.side-content-wrap').stop().animate({'left': '-70%'}, 300) 313 pItem.find('.middle-content-wrap').removeClass('middle-show-content-wrap') 314 pItem.find('.side-content-wrap .mobile-ico-close').remove() 315 } 316 $('.mobile-body-mask').click(function () { 317 $('.mobile-body-mask').remove() 318 $('.mobile-head-item .main-content-wrap').removeClass('show-content-wrap') 319 $('.mobile-head-item .side-content-wrap').animate({'left': '-70%'}, 300) 320 $('.mobile-head-item .middle-content-wrap').removeClass('middle-show-content-wrap') 321 $('.mobile-head-item .side-content-wrap .mobile-ico-close').remove() 322 }) 323 $('.mobile-ico-close').click(function () { 324 $('.mobile-body-mask').remove() 325 $('.mobile-head-item .main-content-wrap').removeClass('show-content-wrap') 326 $('.mobile-head-item .side-content-wrap').stop().animate({'left': '-70%'}, 300) 327 $('.mobile-head-item .middle-content-wrap').removeClass('middle-show-content-wrap') 328 $('.mobile-head-item .side-content-wrap .mobile-ico-close').remove() 329 }) 330 } 331 }) 332 }) 333 $('.change-currency ').clone().appendTo('.mobile-head-item.mobile-head-currency .main-content-wrap .content-wrap') 334 $('.change-language .change-language-cont').clone().appendTo('.mobile-head-item.mobile-head-language .main-content-wrap .content-wrap') 335 $('.nav_wrap .head_nav').clone().appendTo('.mobile-head-item.mobile-head-nav .main-content-wrap .content-wrap') 336 $('.head-search:last').clone().appendTo('.mobile-head-item.mobile-head-search .main-content-wrap .content-wrap') 337 $('.head_sns').clone().appendTo('.mobile-head-item.mobile-head-social .main-content-wrap .content-wrap') 338 $('.aside .aside-wrap').clone().appendTo('.mobile-head-item.mobile-head-aside .main-content-wrap .content-wrap') 339 } 340 } 341 //mobile end 342 else { 343 $(document).ready(function () { 344 $('.mobile-body-mask,.mobile-head-items,.mobile-head-items,.mobile-nav-items,.mobile-cart-items,.mobile-tab-items').remove() 345 }); 346 } 347} 348 349 350 351$(function () { 352 353 var map_width =750; 354 355 if($('map').length > 0){ 356 357 let width_ ; 358 359 if($('.tab-panel-content').width() > 750){width_ = 750;} 360 361 else{width_ = $('.tab-panel-content').width()} 362 363 $('map area').each(function(){ 364 365 let coords = $(this).attr('coords').split(','); 366 367 368 $.each(coords,function(index,value){ 369 370 coords[index] = Number(value)*Number((width_/map_width)); 371 372 }) 373 374 375 $(this).attr('coords',coords.join(',')); 376 377 378 }) 379 380 map_width = width_; 381 } 382 383 384 mSizeChange(); 385 386}) 387 388 389$(window).resize(function () { 390 391 if($('map').length > 0){ 392 393 let width_ = $('map area').eq(0).width(); 394 395 $('map area').each(function(){ 396 397 let coords = $(this).attr('coords').split(','); 398 399 $.each(coords,function(index,value){ 400 401 coords[index] = Number(value)*(width_/map_width); 402 403 }) 404 405 $(this).attr('coords',coords.join(',')); 406 407 408 409 }) 410 411 map_width = width_; 412 } 413 414 mSizeChange() 415}); 416 417 418$(function () { 419 420 var mHeadTop = $('.web_head').offset().top 421 var $backToTopTxt = "TOP", 422 $backToTopEle = $('<span class="gotop"></span>').appendTo($("body")) 423 .html('<em>' + $backToTopTxt + '</em>').attr("title", $backToTopTxt).click(function () { 424 $("html, body").animate({scrollTop: 0}, 600); 425 }), 426 $backToTopFun = function () { 427 var st = $(document).scrollTop(), 428 winh = $(window).height(); 429 (st > mHeadTop) ? $backToTopEle.addClass('active') : $backToTopEle.removeClass('active'); 430 if (!window.XMLHttpRequest) { 431 $backToTopEle.css("top", st + winh - 210); 432 } 433 }; 434 $(window).bind("scroll", $backToTopFun); 435 $(function () { 436 $backToTopFun(); 437 });
438}) 439 440/*side*/ 441function sideCate(cateEle, siblingsStatus) { 442 $(cateEle).each(function () { 443 if ($(this).find('ul').length) { 444 $(this).addClass('has-child'); 445 $(this).append("<span class='icon-cate icon-cate-down'></span>") 446 $(this).children('.icon-cate').click(function (e) { 447 var mEle = $(this).parent('li'); 448 var mList = $(this).parent('li').children('ul'); 449 var msiblings = $(this).parent('li').siblings('li'); 450 if (siblingsStatus == 0) { 451 msiblings.removeClass('li_active'); 452 msiblings.children('ul').slideUp(150); 453 msiblings.children('.icon-cate').removeClass('icon-cate-up').addClass('icon-cate-down'); 454 } 455 if (mList.is(':hidden')) { 456 mEle.addClass('li_active'); 457 mList.slideDown(150); 458 $(this).removeClass('icon-cate-down').addClass('icon-cate-up'); 459 } else { 460 mEle.removeClass('li_active'); 461 mList.slideUp(150); 462 $(this).removeClass('icon-cate-up').addClass('icon-cate-down'); 463 } 464 e.stopPropagation(); 465 }) 466 } 467 }) 468} 469 470$(function () { 471 // side cate 472 sideCate('.side-cate li', 0) 473 $('.side-cate,.side-cate ul').each(function () { 474 if (!$(this).find('ul').length) { 475 $(this).addClass('cate-type-list'); 476 } 477 }) 478 var $currentEle = $('.side-widget .side-cate .nav-current'); 479 if ($currentEle.parents('ul').length > 0 && $currentEle.find('ul').length > 0) { 480 $currentEle.parents('ul').show() 481 $currentEle.parents('li').addClass("show_li") 482 $currentEle.parents('li.show_li').children('.icon-cate').removeClass('icon-cate-down').addClass('icon-cate-up') 483 $currentEle.children('ul').show() 484 $('.side-widget .side-cate .nav-current ').children('.icon-cate').removeClass('icon-cate-down').addClass('icon-cate-up'); 485 } else if ($currentEle.parents('ul').length > 0 && $currentEle.find('ul').length < 1) { 486 $currentEle.parents('ul').show() 487 $currentEle.parents('li').addClass("show_li") 488 $currentEle.parents('li.show_li').children('.icon-cate').removeClass('icon-cate-down').addClass('icon-cate-up') 489 } else if ($currentEle.parents('ul').length < 1 && $currentEle.find('ul').length > 0) { 490 $currentEle.children('ul').show() 491 $currentEle.children('.icon-cate').removeClass('icon-cate-down').addClass('icon-cate-up'); 492 } 493}) 494 495/*tabContainer*/ 496function tabContainer(container, title, panel) { 497 $(container).each(function () { 498 $(this).find(title).each(function () { 499 if ($(this).hasClass('current')) { 500 j = $(this).index(); 501 $(this).parents(container).find(panel).eq(j).removeClass('disabled') 502 } 503 $(this).click(function () { 504 i = $(this).index(); 505 $(this).addClass('current').siblings().removeClass('current'); 506 $(this).parents(container).find(panel).eq(i).show(); 507 $(this).parents(container).find(panel).not($(this).parents(container).find(panel).eq(i)).hide(); 508 }) 509 }) 510 }) 511} 512 513/*search*/ 514document.documentElement.className = 'js'; 515; 516(function (window) { 517 if (document.querySelector('.web-search')) { 518 'use strict'; 519 var mainContainer = document.querySelector('.container'), 520 searchContainer = document.querySelector('.web-search'), 521 openCtrl = document.getElementById('btn-search'), 522 closeCtrl = document.getElementById('btn-search-close'), 523 inputSearch = searchContainer.querySelector('.search-ipt'); 524 525 function init() { 526 initEvents() 527 } 528 529 function initEvents() { 530 openCtrl.addEventListener('click', function () { 531 if (!searchContainer.classList.contains("search--open")) { 532 openSearch(); 533 } else { 534 closeSearch(); 535 } 536 }); 537 closeCtrl.addEventListener('click', closeSearch); 538 document.addEventListener('keyup', function (ev) { 539 if (ev.keyCode == 27) { 540 closeSearch() 541 } 542 }) 543 } 544 545 function openSearch() { 546 mainContainer.classList.add('main-wrap--move'); 547 searchContainer.classList.add('search--open'); 548 setTimeout(function () { 549 inputSearch.focus() 550 }, 600) 551 } 552 553 function closeSearch() { 554 mainContainer.classList.remove('main-wrap--move'); 555 searchContainer.classList.remove('search--open'); 556 inputSearch.blur(); 557 inputSearch.value = '' 558 } 559 560 init() 561 } 562})(window); 563 564 565$(function () { 566 $("#scrollsidebar").fix({float: 'right', durationTime: 400}); 567}); 568$('.business_right .events li').on('click', function () { 569 $(this).addClass('current').siblings("li").removeClass('current') 570 var i = $(this).index() 571 $(this).parents('.index_business').find('.business_middle .tab_content').eq(i).addClass('current').siblings(".tab_content").removeClass('current') 572}) 573$('table').each(function () { 574 if (!$(this).parent().hasClass('table_wrap')) { 575 $(this).wrap("<div class='table_wrap'><//div>") 576 } 577}) 578 579
580/* -------------- public Function --------------*/ 581 582 583/*! 584 忢CLASS 585 ---------- 586 * 说æ: 587 * btn: æé® 588 * cont: ææ§çå 容 589 * cName: 忢çclassName 590 * siblingsStatus: å级æ¯å¦å ³é(0:å ³é,å ¶ä»å¼:ä¸åclickå½±å) 591*/ 592function toggleClass(btn, cont, cName, hName, siblingsStatus) { 593 var $btn = $(btn); 594 var $cont = $(cont); 595 if (siblingsStatus == 0) { 596 $btn.parents(cont).siblings(cont).removeClass(cName).addClass(hName); 597 } 598 if ($btn.parents(cont).hasClass(cName)) { 599 $btn.parents(cont).removeClass(cName).addClass(hName); 600 } else { 601 $btn.parents(cont).addClass(cName).removeClass(hName); 602 } 603} 604 605// set head nav Direction 606function menuDirection(ele) { 607 var winW = $(window).innerWidth(); 608 $(ele).each(function () { 609 if ($(this).find('ul').length) { 610 var linkEleW = $(this).children('a').width(); 611 var offRight = winW - $(this).offset().left; 612 var childLen = $(this).find('ul').length; 613 var childrenWidth = childLen * 250 + 10; 614 if (offRight < childrenWidth) { 615 $(this).addClass('menu_left'); 616 } else { 617 $(this).removeClass('menu_left'); 618 } 619 } 620 }) 621} 622 623// dropMenu 624function dropMenu(menuItem, menuList, menustatus, showClass) { 625 var mouseover_tid = []; 626 var mouseout_tid = []; 627 if (showClass) { 628 showClass = showClass; 629 } else { 630 showClass = 'active'; 631 } 632 $(menuItem).each(function (index) { 633 $(this).hover( 634 function () { 635 var _self = this; 636 clearTimeout(mouseout_tid[index]); 637 mouseover_tid[index] = setTimeout(function () { 638 if (menustatus == '1') { 639 $(_self).children(menuList).slideDown(150); 640 } 641 $(_self).addClass(showClass); 642 }, 150); 643 }, 644 function () { 645 var _self = this; 646 clearTimeout(mouseover_tid[index]); 647 mouseout_tid[index] = setTimeout(function () { 648 if (menustatus == '1') { 649 $(_self).children(menuList).slideUp(50); 650 } 651 $(_self).removeClass(showClass); 652 }, 150); 653 } 654 ); 655 }) 656} 657 658 659/* -------------- header --------------*/ 660 661// dropmenu direction 662$(function () { 663 menuDirection('.head_nav>li'); 664 $(window).on('resize', function () { 665 menuDirection('.head_nav>li'); 666 }) 667}) 668 669$(function () { 670 $('.nav_wrap').append('<span class="nav_btn_close"></span>'); 671 $('body').delegate('.head_nav li b', 'click', function () { 672 var navItem = $(this).closest('li'); 673 var navMenu = navItem.children('ul'); 674 if (navMenu.is(':hidden')) { 675 navMenu.slideDown(150, function () { 676 navItem.addClass('active'); 677 }); 678 } else { 679 navItem.removeClass('active'); 680 navMenu.slideUp(150); 681 } 682 return false; 683 }) 684}) 685 686 687/* -------------- index --------------*/ 688 689// index_company_intr 690if ($('.index_company_intr .swiper-slide').length > 1) { 691 var introSwiper = new Swiper('.company_intr_gallery .swiper-container', { 692 slidesPerView: 1, 693 slidesPerGroup: 1, 694 loop: true, 695 autoplay: { 696 delay: 4500, 697 disableOnInteraction: false, 698 }, 699 speed: 400, 700 spaceBetween: 0, 701 effect: 'fade', 702 watchOverflow: true, 703 pagination: { 704 el: '.index_company_intr .swiper-pagination', 705 clickable: true 706 }, 707 navigation: {}, 708 breakpoints: {} 709 }) 710} 711 712 713/* -------------- subpage --------------*/ 714var sideProduct = new Swiper('.side_slider', { 715 slidesPerView: 3, 716 slidesPerGroup: 1, 717 spaceBetween: 10, 718 direction: 'vertical', 719 navigation: { 720 nextEl: '.side-product-items .btn-next', 721 prevEl: '.side-product-items .btn-prev', 722 }, 723 pagination: { 724 el: '.side-product-items .swiper-pagination', 725 clickable: true, 726 }, 727}); 728 729 730if ($('.sys_sub_head .head_bn_item').length > 1) { 731 var hdSwiper = new Swiper('.head_bn_slider .swiper-container', { 732 effect: 'fade', 733 speed: 1000, 734 loop: true, 735 spaceBetween: 0, 736 watchOverflow: true, 737 autoplay: { 738 delay: 3500, 739 disableOnInteraction: false, 740 }, 741 pagination: { 742 el: '.sys_sub_head .swiper-pagination', 743 clickable: true, 744 } 745 });
746} 747 748 749// search 750$(function () { 751 $(document).on('click', function () { 752 $('.container').removeClass('main-wrap--move'); 753 $('.web-search').removeClass('search--open'); 754 }) 755 $('.btn--search,.web-search').on('click', function (e) { 756 e.stopPropagation(); 757 }) 758}) 759 760 761// button 762$(".sys_btn_wave").mouseenter(function (e) { 763 var parentOffset = $(this).offset(); 764 var relX = e.pageX - parentOffset.left; 765 var relY = e.pageY - parentOffset.top; 766 $(this).find(".btn_wave_circle").css({"left": relX, "top": relY}); 767 $(this).find(".btn_wave_circle").removeClass("desplode-circle"); 768 $(this).find(".btn_wave_circle").addClass("explode-circle"); 769}); 770$(".sys_btn_wave").mouseleave(function (e) { 771 var parentOffset = $(this).offset(); 772 var relX = e.pageX - parentOffset.left; 773 var relY = e.pageY - parentOffset.top; 774 $(this).find(".btn_wave_circle").css({"left": relX, "top": relY}); 775 $(this).find(".btn_wave_circle").removeClass("explode-circle"); 776 $(this).find(".btn_wave_circle").addClass("desplode-circle"); 777}); 778 779 780/******* zengzhifuwu neirong ******* */ 781function formatDecimal(num, decimal) { 782 num = num.toString() 783 let index = num.indexOf('.') 784 if (index !== -1) { 785 num = num.substring(0, decimal + index + 1) 786 } else { 787 num = num.substring(0) 788 } 789 return parseFloat(num).toFixed(decimal) 790} 791 792 793$(function () { 794 795 796 let yanzheng = () => { 797 798 $('.product_info select').removeClass('error') 799 800 let stasc = true; 801 802 $('.product_info select').each(function () { 803 804 if ($(this).val() == '' || $(this).val() == undefined) { 805 806 stasc = false; 807 808 $(this).addClass('error') 809 } 810 811 }) 812 813 814 if (stasc == false) { 815 816 alert('There are still options not fulled in.') 817 } 818 819 820 } 821 822 function fMoney(s, n) { 823 n = n > 0 && n <= 20 ? n : 3; 824 s = parseFloat((s + "").replace(/[^\d\.-]/g, "")).toFixed(n) + ""; 825 var l = s.split(".")[0].split("").reverse(), r = s.split(".")[1]; 826 t = ""; 827 for (i = 0; i < l.length; i++) { 828 t += l[i] + ((i + 1) % 3 == 0 && (i + 1) != l.length ? "," : ""); 829 } 830 return t.split("").reverse().join("") + "." + r; 831 } 832 833 if ($('.select_img_data_box').length > 0) { 834 835 $('.inquiry-pop-bd .inquiry-pop #customer-chat-iframe').remove(); 836 837 838 } 839 840 841 //å°è£ ajax 842 843 //计ç®åå§ä»·æ ¼ 844 845 var zk = $('.page_title').attr("value") 846 847 let Initial_price = (number) => { 848 849 let Price_range = 0; 850 851 let product_num = Number($('.ipt-qty').val()); 852 853 $('.wholesale-price-info table tbody tr:nth-child(n+2)').each(function () { 854 855 let a = Number($(this).find('td').eq(0).text().split('-')[0].replace(/(^\s*)|(\s*$)/g, '')) 856 857 let b = Number($(this).find('td').eq(0).text().split('-')[1].replace(/[A-Za-z]/g, "").replace(/(^\s*)|(\s*$)/g, '')) 858 859 let c = Number($(this).find('td').eq(1).attr('data-price')) 860 861 862 if (b !== 0) { 863 864 if (a < product_num || a == product_num && product_num < b || product_num == b) { 865 866 Price_range = c * zk; 867 868 } 869 } else { 870 871 if (a < product_num || a == product_num) { 872 873 Price_range = c * zk; 874 875 } 876 877 } 878 879 }) 880 881 return (number * zk) + Price_range; 882 } 883 884 885 //计ç®å¢å¼ä»·æ ¼åä»·å¹¶èµäºæä»¶ä»·æ ¼ 886 887 let added_price = (type_) => { 888 889 $('select[name^="diy_option[accessories"]').val(''); 890 891 let number = 0; 892 893 let b = parseFloat($('.page_title').attr("value")); 894 895 function formatDecimal(num, decimal) { 896 num = num.toString() 897 let index = num.indexOf('.') 898 if (index !== -1) { 899 num = num.substring(0, decimal + index + 1) 900 } else { 901 num = num.substring(0) 902 } 903 return parseFloat(num).toFixed(decimal) 904 } 905 906 $('.product_info select').each(function () { 907 908 let data_title = $(this).val().replace(/(^\s*)|(\s*$)/g, '') 909 910 $('select[name^="diy_option[accessories"] option').each(function () { 911 912 if ($(this).val().split('@')[0].replace(/(^\s*)|(\s*$)/g, '') == data_title) { 913 914 $(this).parent().val($(this).val()); 915 916 number = number + Number($(this).val().split('@')[1].replace(/(^\s*)|(\s*$)/g, '')); 917 918 919 } 920 921 922 }) 923 924 }) 925 if (number == 0) { 926 927 $('.wholesale-price-info table tbody tr:nth-child(n+2)').each(function () { 928 929 $(this).find('td').eq(1).text('USD$' + (formatDecimal(parseFloat($(this).find('td').eq(1).attr('data-price')) * b, 2))) 930 931 }) 932 933 } else { 934 935 if (type_ == 'change') { 936 937 $('.wholesale-price-info table tbody tr:nth-child(n+2)').each(function () { 938 939 let a = (parseFloat($(this).find('td').eq(1).attr('data-price')) + parseFloat(number)); 940 941 a = a * b 942 943 $(this).find('td').eq(1).text('USD$' + formatDecimal(a, 2)) 944 945 946 }) 947 948 } 949 950 } 951 952 return Initial_price(number); 953 } 954 955 //è®¡ç®æ»ä»·å¹¶è¿åä»·æ ¼ 956
957 let Calculate = (added_price) => { 958 959 let Calculate_price = formatDecimal((added_price),2)* Number($('.ipt-qty').val()) 960 961 return Calculate_price; 962 963 } 964 965 //渲æå°å端 966 967 let html_price = (Calculate) => { 968 969 $('.price-info').html('<span>USD$' + formatDecimal(Calculate,2) + '</span>') 970 971 } 972 973 974 $('.ipt-qty').on('change', function () { 975 976 html_price(Calculate(added_price())) 977 978 }) 979 980 981 //é颿 ¼å¼å(éå·åé) 982 983 984 $(function () { 985 //å®ä¹ååæ¶é´ 986 countDown(" 23:59:59", ".goods-time-count .day", ".goods-time-count .hour", ".goods-time-count .minute", ".goods-time-count .second"); 987 }); 988 989 function countDown(time, day_elem, hour_elem, minute_elem, second_elem) { 990 var end_time = new Date(time).getTime(), 991 sys_second = (end_time - new Date().getTime()) / 1000; 992 var timer = setInterval(function () { 993 if (sys_second > 0) { 994 sys_second -= 1; 995 var day = Math.floor((sys_second / 3600) / 24); 996 var hour = Math.floor((sys_second / 3600) % 24); 997 var minute = Math.floor((sys_second / 60) % 60); 998 var second = Math.floor(sys_second % 60); 999 day_elem && $(day_elem).html(day); 1000 $(hour_elem).text(hour < 10 ? "0" + hour + '' : hour + ''); 1001 $(minute_elem).text(minute < 10 ? "0" + minute + '' : minute + ''); 1002 $(second_elem).text(second < 10 ? "0" + second : second); 1003 $('.goods-time-count p').css({'display': 'inline-block'}) 1004 } else { 1005 clearInterval(timer); 1006 $('.goods-time-count').html('') 1007 } 1008 $('.goods-time-count .time-coming').remove() 1009 }, 1000); 1010 } 1011 1012 $('.goods-time-count').append("<span class='time-coming'></span>") 1013 $(document).ready(function () { 1014 //䏿æ¡--éæ©ç¬¬äºé¡¹,å±ç¤ºèªå®ä¹ 1015 $('.select-with-custom').change(function () { 1016 if (this.selectedIndex == 1) { 1017 $(this).parents('.form-item').find('.custom-form').show() 1018 } else { 1019 $(this).parents('.form-item').find('.custom-form').hide() 1020 } 1021 }) 1022 }) 1023 //䏿æ¡ç¾å 1024 $.fn.clicktoggle = function (a, b) { 1025 return this.each(function () { 1026 var clicked = false; 1027 $(this).click(function () { 1028 if (clicked) { 1029 clicked = false; 1030 return b.apply(this, arguments); 1031 } 1032 clicked = true; 1033 return a.apply(this, arguments); 1034 }); 1035 }); 1036 }; 1037 1038 $(document).ready(function () { 1039//ä»·æ ¼åå¨ 1040 $(function () { 1041 var triggerBind = $(function () { 1042 $('body').append('<div style="display:none" class="price-add-list"></div><div style="display:none" class="mkt-price-add-list"></div>') 1043 $(".product-shop .form-item").each(function () { 1044 var i = $(this); 1045 var p = $(this).find('.price-change'); 1046 1047 function getobjVal() { 1048 } 1049 1050 p.change(function () { 1051 i.attr("data-attrval", $(this).attr("value")) 1052 if ($(this).parents('dl').hasClass('check-item')) { 1053 if (!$(this).parents('.check-item').find('input[type="checkbox"]').is(':checked')) { 1054 $(this).parents('.form-item').attr("data-attrval", 0) 1055 } 1056 } 1057 getattrprice() 1058 }) 1059 p.click(function () { 1060 p.attr("data-attrval", $(this).attr("value")); 1061 $("#bigImg").attr({src: $(this).attr("data-img")}); 1062 $("#bigImg").attr({jqimg: $(this).attr("data-img")}); 1063 if ($(this).parents('dl').hasClass('check-item')) { 1064 if (!$(this).parents('.check-item').find('input[type="checkbox"]').is(':checked')) { 1065 $(this).parents('.form-item').attr("data-attrval", 0) 1066 } 1067 } 1068 getattrprice() 1069 }) 1070 }) 1071 $('.product-buy .btn-minus,.product-buy .btn-plus').click(function () { 1072 getattrprice() 1073 1074 }) 1075 1076 //ååæ°é 1077 $('.product-buy .ipt-qty').change(function () { 1078 getattrprice() 1079 }) 1080 var oldPrice = $('.old-price i').text().replace(',', '') 1081 var curPrice = $('.special-price i').text().replace(',', '') 1082 1083 function getattrprice() { 1084 var defaultstats = true; 1085 var _val = ''; 1086 var _resp = { 1087 mktprice: ".old-price i", 1088 price: ".special-price i" 1089 } 1090 $('.price-add-list li,.mkt-price-add-list li').remove()
1091 $(".product-shop .form-item").each(function () { 1092 var i = $(this); 1093 var v = i.attr("data-attrval"); 1094 if (!v) { 1095 defaultstats = false; 1096 } else { 1097 _val = v; 1098 $('.price-add-list').append('<li>' + (parseFloat(sys_item['sys_attrprice'][_val]['price'].replace(',', ''))).toFixed(2) + ' ' + '</li>') 1099 $('.mkt-price-add-list').append('<li>' + (parseFloat(sys_item['sys_attrprice'][_val]['mktprice'].replace(',', ''))).toFixed(2) + ' ' + '</li>') 1100 } 1101 }) 1102 1103 var addPrice = 0 1104 $('.price-add-list li').each(function () { 1105 addPrice = addPrice + parseFloat($(this).text()); 1106 }) 1107 var addMktPrice = 0 1108 $('.mkt-price-add-list li').each(function () { 1109 addMktPrice = addMktPrice + 1 * parseFloat($(this).text()); 1110 }) 1111 1112 var gNums = $('.ipt-qty').val() 1113 _mktprice = fMoney((parseFloat(addMktPrice) + parseFloat(oldPrice)).toFixed(2)); 1114 _price = fMoney(((parseFloat(addPrice) + parseFloat(curPrice)) * gNums).toFixed(2)); 1115 $(_resp.mktprice).text(_mktprice); 1116 $(_resp.price).text(_price); 1117 1118 $('.product-summary').each(function () { 1119 var curPrice = parseFloat($('.product-summary').find('.special-price i').text().replace(',', '')) 1120 var oPrice = parseFloat($('.product-summary').find('.old-price i').text().replace(',', '')) 1121 if (curPrice < oPrice) { 1122 var discount = Math.round((1 - curPrice / oPrice) * 100) 1123 $('.product-summary').find('.discount b').html(discount) 1124 } else { 1125 $('.product-summary').find('.discount').hide() 1126 } 1127 }) 1128 1129 html_price(Calculate(added_price(), Initial_price()
1129)) 1130 1131 } 1132 1133 //åéæ¡ç¾å 1134 $('.color-list li,.size-list li,.keyss-list li').each(function () { 1135 var input = $(this).find('input'); 1136 var option = $(this).find('option'); 1137 if ($(this).find('input:checked').length > 0) { 1138 $(this).addClass('checked'); 1139 } 1140 $(this).click(function () { 1141 if ($(this).find('input').is(':checked')) { 1142 $(this).addClass('checked').siblings().removeClass('checked'); 1143 var cat = $(this).attr('data-cat'); 1144 var relate = $(this).attr('data-relate'); 1145 var val = $(this).attr('data-val'); 1146 var in_html = ''; 1147 if (relate != '') { 1148 $("#form_item_" + relate + "_all").html(''); 1149 var show_style = $("#form_item_" + relate + "_all").attr('data-style'); 1150 if (show_style == 'select') { 1151 in_html += '<dl> <dt>' + relate + ': </dt> <dd><div class="select-box change-item"><select id="a' + name_str + '" name="diy_option[' + relate + ']" class="select-size select-with-custom price-change select-require"><option value="0">--- Please Select ---</option>'; 1152 for (var k in relate_json[cat][val][relate]) { 1153 var name_str = relate_json[cat][val][relate][k]; 1154 var name_arr = name_str.split("@"); 1155 in_html += '<option value="' + name_str + '">' + name_arr[0] + '</option>'; 1156 } 1157 in_html += '</select></div><div class="form-error-msg"> --- Please Select ---</div> </dd></dl>'; 1158 $("#form_item_" + relate + "_all").append(in_html); 1159 $('.select-box select').dropkick(); 1160 } else if (show_style == 'checkbox') { 1161 in_html += '<dl> <dt>' + relate + ': </dt> <dd><ul class="check-require tags-for-color">'; 1162 for (var k in relate_json[cat][val][relate]) { 1163 var name_str = relate_json[cat][val][relate][k]; 1164 var name_arr = name_str.split("@"); 1165 in_html += '<li><input class="price-change" type="radio" value="' + name_str + '" id="a' + name_str + '" name="diy_option[' + relate + ']" data-attrval="' + name_str + '"><label for="a' + name_str + '"> <span class="size-value">' + name_arr[0] + '</span> <b class="ico-tick"> </b></label> </li>'; 1166 } 1167 in_html += '</ul><div class="form-error-msg"> --- Please Select ---</div> </dd></dl>'; 1168 $("#form_item_" + relate + "_all").append(in_html); 1169 } else { 1170 in_html += '<dl> <dt>' + relate + ': </dt> <dd><ul class="size-list check-require tags-for-color">'; 1171 for (var k in relate_json[cat][val][relate]) { 1172 var name_str = relate_json[cat][val][relate][k]; 1173 var name_arr = name_str.split("@"); 1174 in_html += '<li><input class="price-change" type="radio" value="' + name_str + '" id="a' + name_str + '" name="diy_option[' + relate + ']" data-attrval="' + name_str + '"><label for="a' + name_str + '"> <span class="size-value">' + name_arr[0] + '</span> <b class="ico-tick"> </b></label> </li>'; 1175 } 1176 in_html += '</ul><div class="form-error-msg"> --- Please Select ---</div> </dd></dl>'; 1177 $("#form_item_" + relate + "_all").append(in_html); 1178 } 1179 var i = $("#form_item_" + relate + "_all"); 1180 var p = $("#form_item_" + relate + "_all").find('.price-change'); 1181 1182 function getobjVal() { 1183 } 1184 1185 p.change(function () { 1186 i.attr("data-attrval", $(this).attr("value")) 1187 if ($(this).parents('dl').hasClass('check-item')) { 1188 if (!$(this).parents('.check-item').find('input[type="checkbox"]').is(':checked')) { 1189 $(this).parents('.form-item').attr("data-attrval", 0) 1190 } 1191 } 1192 getattrprice() 1193 }) 1194 p.click(function () { 1195 $(this).parents('li').addClass('checked'); 1196 $(this).parents('li').addClass('checked').siblings().removeClass('checked'); 1197 p.attr("data-attrval", $(this).attr("value")); 1198 $("#bigImg").attr({src: $(this).attr("data-img")}); 1199 $("#bigImg").attr({jqimg: $(this).attr("data-img")}); 1200 if ($(this).parents('dl').hasClass('check-item')) { 1201 if (!$(this).parents('.check-item').find('input[type="checkbox"]').is(':checked')) { 1202 $(this).parents('.form-item').attr("data-attrval", 0) 1203 } 1204 } 1205 getattrprice() 1206 }) 1207 } 1208 } else { 1209 $(this).removeClass('checked') 1210 } 1211 }) 1212 }) 1213 1214 //客æ·èªå®ä¹åååæ°-åéæ¡ 1215 $('.radio-custom-set').click(function () {
1216 if ($(this).find('input:checked').length > 0) { 1217 $(this).prevAll().find('input[type="radio"]').attr({ 1218 'checked': false, 1219 'disabled': 'disabled' 1220 }) 1221 $(this).prevAll().removeClass('checked') 1222 $(this).prevAll().addClass('radio-disabled') 1223 $(this).addClass('checked') 1224 $(this).parents('.form-item').find('.custom-form').show() 1225 } else { 1226 $(this).prevAll().removeClass('radio-disabled') 1227 $(this).prevAll().find('input[type="radio"]').removeAttr("disabled") 1228 $(this).removeClass('checked') 1229 $(this).parents('.form-item').find('.custom-form').hide() 1230 } 1231 }) 1232 1233 //å¼¹åºé¢è²å¾ç 1234 $('.color-list li').each(function () { 1235 if (!$(this).hasClass('radio-custom-set')) { 1236 var colorImg = $(this).find('.color-small-img img').data('big') 1237 var colorName = $(this).find('.color-small-img img').data('name') 1238 $(this).append('<div class="color-img-pop"><img src=' + colorImg + '><span class="color-name">' + colorName + '</span></div>') 1239 $(this).hover(function () { 1240 $(this).toggleClass('z9999') 1241 }) 1242 } 1243 }) 1244 1245 1246 //æµ®å¨å°å¾ 1247 $('.tags-for-color li').each(function () { 1248 if (typeof ($(this).find('.size-value').attr("data-big")) != "undefined" && typeof ($(this).find('.size-value').attr("data-name")) != "undefined" && !$(this).hasClass('radio-custom-set')) { 1249 var colorImg = $(this).find('.size-value').data('big') 1250 var colorName = $(this).find('.size-value').data('name') 1251 $(this).append('<div class="color-img-pop"><img src=' + colorImg + '><span class="color-name">' + colorName + '</span></div>') 1252 $(this).hover(function () { 1253 $(this).toggleClass('z9999') 1254 }) 1255 } 1256 }) 1257 1258 1259 }) 1260 }) 1261 })//ready 1262 //å¿ å¡«(åååæ°) 1263 $('.add-to-cart').click(function () { 1264 var requireNum = 0; 1265 $(this).parents('form').find("input.ipt-require").each(function (n) { 1266 if ($(this).val() == "") { 1267 requireNum++; 1268 $(this).parents('dl').find('.form-error-msg').show() 1269 } else { 1270 $(this).parents('dl').find('.form-error-msg').hide() 1271 } 1272 }); 1273 $(this).parents('form').find("input.ipt-require").blur(function () { 1274 if ($(this).val() == "") { 1275 requireNum++; 1276 $(this).parents('dl').find('.form-error-msg').show() 1277 } else { 1278 $(this).parents('dl').find('.form-error-msg').hide() 1279 } 1280 }); 1281 1282 $(this).parents('form').find(".check-require").each(function (n) { 1283 if ($(this).find('input:checked').length < 1) { 1284 requireNum++; 1285 $(this).parents('dl').find('.form-error-msg').show() 1286 } else { 1287 $(this).parents('dl').find('.form-error-msg').hide() 1288 } 1289 }); 1290 $(this).parents('form').find(".check-require").click(function () { 1291 if ($(this).find('input:checked').length < 1) { 1292 requireNum++; 1293 $(this).parents('dl').find('.form-error-msg').show() 1294 } else { 1295 $(this).parents('dl').find('.form-error-msg').hide() 1296 } 1297 }); 1298 1299 1300 $(this).parents('form').find('.select-require').each(function () { 1301 if ($(this).val() == $(this).find("option:first").val()) { 1302 requireNum++ 1303 $(this).parents('.form-item').find('.form-error-msg').show() 1304 } else { 1305 $(this).parents('.form-item').find('.form-error-msg').hide() 1306 } 1307 }) 1308 $(this).parents('form').find('.select-require').change(function () { 1309 if ($(this).val() == $(this).find("option:first").val()) { 1310 $(this).parents('.form-item').find('.form-error-msg').show() 1311 } else { 1312 $(this).parents('.form-item').find('.form-error-msg').hide() 1313 } 1314 }) 1315 1316 if (requireNum > 0) { 1317 return false; 1318 } else { 1319 $('.task-cont-wrap').fadeIn(500) 1320 $('.cart-successful .cart-successful-close,.cart-successful .return-current').click(function () { 1321 window.location.reload() 1322 $('.task-cont-wrap').fadeOut(500) 1323 }) 1324 return true; 1325 } 1326 }) 1327 $.fn.ready(function () { 1328 1329 });
1330 1331 1332//reset form 1333// $(window).load(function () { 1334// $('.product-shop form')[0].reset() 1335// }); 1336 1337 1338 var send_email = '<a href="javascript:" class="email email add-to-cart">Send email to us</a>';//表åæäº¤æé® 1339 1340 var btn_cart_html = '<input class="btn-add-cart add-to-cart" value="ADD TO CART" title="Add selected item to your shopping basket" type="submit">';//è´ç©è½¦æäº¤æé® 1341 1342 let add_change_ = (send_email,form_data_init_,select_data,dingzhi,inquiry_html,from_yanzheng_,form_data) => { 1343 1344 if ($('.Customized_box').length > 0) { 1345 1346 if ($('.quantity .email').length < 1) { 1347 1348 $('.quantity .btn-add-cart.add-to-cart').remove(); 1349 1350 $('.price-bar').hide(); 1351 1352 $('.Prices_tishi').show() 1353 1354 $('.quantity').append(send_email) 1355 1356 $('.quantity .email').on('click', function () { 1357 1358 if (form_data_init_() == false) { 1359 1360 alert('Please fill in the information completely') 1361 1362 } else { 1363 1364 1365 $('.inquiry-pop-bd .inquiry-pop').append(inquiry_html) 1366 1367 1368 $('.inquiry-pop-bd').fadeIn('fast') 1369 1370 //è·ååè¡¨æ°æ® 1371 1372 $('.product_info select').each(function () { 1373 1374 var title = $(this).parent('li').children('span').text(); 1375 1376 if ($(this).val() == dingzhi) { 1377 1378 title = title + '(' + $(this).val() + ')' 1379 1380 select_data[title] = $(this).parent().children('.Customized_box').find('textarea').val(); 1381 1382 } else { 1383 1384 select_data[title] = $(this).val(); 1385 } 1386 1387 }) 1388 1389 1390 $('#customer-chat-widget #customer-chat-contact-send').click(function () { 1391 1392 1393 if (from_yanzheng_('#customer-chat-widget') == true) { 1394 1395 1396 //è·å产åID 1397 1398 form_data['product_id'] = $('#productID').attr('value'); 1399 1400 //è·åç¨æ·ä¿¡æ¯ 1401 1402 $('.inquiry-pop-bd #customer-chat-widget .customer-chat-content-message-input').each(function () { 1403 1404 form_data[$(this).children().attr('data-name')] = $(this).children().val(); 1405 1406 }) 1407 1408 form_data['inquirymeta'] = select_data; 1409 1410 1411 //使ç¨Ajaxæäº¤æ°æ® 1412 1413 $.ajax({
1414 1415 type: "POST", //Postè¯·æ± 1416 1417 data: JSON.stringify(form_data), //æäº¤æ°æ® 1418 1419 async: false, 1420 1421 url: "/wp-admin/admin-ajax.php?action=show_data_inquiry", //æ¥å£ 1422 1423 success: function (data) { 1424 1425 alert('Submitted successfully'); 1426 1427 hideMsgPop(); 1428 } 1429 1430 }) 1431 1432 } else { 1433 1434 alert('E-mail format is incorrect') 1435 1436 } 1437 1438 }) 1439 1440 1441 } 1442 1443 }) 1444 1445 $('.quantity .email').click(function (e) { 1446 e.stopPropagation(); 1447 }) 1448 1449 } 1450 } else { 1451 1452 if ($('.quantity .btn-add-cart.add-to-cart').length < 1) { 1453 1454 $('.quantity .email').remove(); 1455 1456 $('.price-bar').show(); 1457 1458 $('.Prices_tishi').hide() 1459 1460 $('.quantity').append(btn_cart_html) 1461 1462 $('.btn-add-cart.add-to-cart').on('click', function () { 1463 1464 yanzheng() 1465 1466 }) 1467 1468 } 1469 } 1470 } 1471 1472 $('.product_info > li select').on('change', function () { 1473 1474 $(this).removeClass('error') 1475 1476 if ($(this).val() == 'Customized') { 1477 1478 1479 $(this).parent().append('<div class="Customized_box"><textarea placeholder="Please fill in the parameters" autofocus="autofocus" cols="20" rows="3"></textarea></div>'); 1480 1481 add_change_(send_email) 1482 1483 1484 } else { 1485 1486 1487 $(this).parent().find('.Customized_box').remove(); 1488 1489 var i = $(this).find('option:checked').index(); 1490 1491 var data_title = $(this).parent('li').children('span').text().replace(/(^\s*)|(\s*$)/g, ''); 1492 1493 1494 $('.form-item').each(function () { 1495 1496 if (data_title == $(this).children('dl').children('dt').text().replace(/(^\s*)|(\s*$)/g, '')) { 1497 1498 $(this).find('select').val($(this).find('select option').eq(i).val()) 1499 1500 } 1501 }) 1502 1503 html_price(Calculate(added_price('change')))//è°ç¨ 1504 } 1505 1506 add_change_(send_email) 1507 1508 }) 1509 1510 1511 function ajax_data_send(object, url, type, fn_) { 1512 1513 1514 //attribute 1515 1516 var type_ = type; //æäº¤çæ°æ®ç±»å 1517 1518 var dingzhi = 'Customized';//å®å¶åæ° 1519 1520 var Customized_box = '<div class="Customized_box"><textarea placeholder="Please fill in the parameters" autofocus="autofocus" cols="20" rows="3"></textarea></div>';//å®å¶æ¡ 1521 1522 1523 var form_data = {}; //è¡¨åæ°æ® 1524 1525 var select_data = {}; //åè¡¨æ°æ® 1526 1527 var inquiry_html = '<div id="customer-chat-widget"class="customer-chat customer-chat-widget customer-chat-visible contact-form"><div class="customer-chat-header"><div class="customer-chat-header-title">Leave Your Message</div></div><div id="customer-chat-content-contact-form"class="customer-chat-content"><div class="form"><div class="customer-chat-content-message-input" style="width: 60%;"><input data-name="username" id="customer-chat-contact-name" type="text" class="customer-chat-content-message-input-field" placeholder="* Name"></div><div class="customer-chat-content-message-input"style="width: 60%;"><input data-name="email" id="customer-chat-contact-mail"type="email"class="customer-chat-content-message-input-field"placeholder="* Email (We will reply you via email in 24 hours)"></div><div class="customer-chat-content-message-input"style="width: 60%;"><input data-name="phone" id="customer-chat-contact-phone"type="text"class="customer-chat-content-message-input-field"placeholder="Phone/WhatsApp/WeChat ( Very important )"></div><div class="customer-chat-content-message-input"style="height:95px;"><textarea data-name="content" style=" width:100%; height:95px;"id="customer-chat-contact-message"class="customer-chat-content-message-input-field"placeholder="* Your question"></textarea></div><div class="customer-chat-content-row"><a href="#"id="customer-chat-contact-send"class="customer-chat-content-button">Send<i class="icon-circle-arrow-right icon-white"style="margin: 3px 0 0 3px;"></i></a></div></div></div></div>'; 1528 1529 1530 //function 1531 1532 $(object).on(fn_, function () { 1533 1534 if(fn_ == 'change'){$(this).removeClass('error')} 1535 1536 1537 var index = $(this).index(); 1538 1539 var data_arr = {}; 1540 1541 1542 html_price(Calculate(added_price('change'))) 1543 1544 //æä»¶èµå¼ 1545 1546 var i = $(this).find('option:checked').index(); 1547 1548 var data_title = $(this).parent('li').children('span').text().replace(/(^\s*)|(\s*$)/g, ''); 1549 1550 var data_title_content = $(this).parent('li').find('select option:selected').val() 1551 1552 $('.form-item').each(function () { 1553 1554 if (data_title == $(this).children('dl').children('dt').text().replace(/(^\s*)|(\s*$)/g, '')) { 1555 1556 $(this).find('select').val(data_title_content+"@@@") 1557 1558 } 1559 }) 1560 1561 1562 if (type_ == 'text' && $(this).val() == dingzhi) { 1563 1564 $(this).html('<option value="Customized">Customized</option><option value="">Please select</option>') 1565 1566 } 1567 1568 1569 //循ç¯å¯¹è±¡ 1570 1571 $(object).each(function (index) { 1572 1573 var data_ = ''; 1574 1575 if ($(this).find('option:checked').val() !== dingzhi) { 1576 1577 $(this).parent('li').find('.Customized_box').remove(); 1578 1579 data_ = $(this).find('option:checked').val(); 1580 1581 data_arr[$(this).attr('name')] = data_; 1582 1583 } else { 1584 1585 1586 //æ·»å å®å¶ææ¬æ¡ 1587
1588 $('.select_img_data_box').slideUp(300, function () { 1589 1590 $('.select_img_data_box').hide(); 1591 }); 1592 1593 if ($(this).parent().find('.Customized_box').length < 1) { 1594 1595 $(this).parent().append(Customized_box); 1596 1597 } 1598 1599 1600 } 1601 1602 }) 1603 1604 //éªè¯è¡¨å弿¯å¦å¡«å å®å ¨ 1605 1606 var form_data_init_ = () => { 1607 1608 var fn_data = true; 1609 1610 $('.product_info select').each(function () { 1611 1612 if ($(this).val() == '') { 1613 1614 1615 fn_data = false; 1616 } else if ($(this).val() == dingzhi) { 1617 1618 1619 if ($(this).parent().find('textarea').val() == '' || $(this).parent().find('textarea').val() == undefined) { 1620 1621 fn_data = false; 1622 1623 } 1624 } 1625 1626 }) 1627 1628 return fn_data; 1629 1630 } 1631 1632 1633 //表åéªè¯function 1634 1635 var from_yanzheng_ = (object) => { 1636 1637 var form_text_fn = true; 1638 1639 $(object).find('input').each(function () { 1640 1641 if ($(this).val() == '' || $(this).val() == undefined) { 1642 1643 form_text_fn = false; 1644 1645 } 1646 if (index == 0) { 1647 1648 1649 if ($(this).val() !== /^([a-zA-Z\d])(\w|\-)+@[a-zA-Z\d]+\.[a-zA-Z]{2,4}$/) { 1650 1651 form_text_fn = false; 1652 1653 } 1654 1655 } 1656 1657 1658 }) 1659 1660 return form_text_fn; 1661 1662 } 1663 1664 1665 //éå表åéªè¯æäº¤æ¹å¼ 1666 1667 1668 add_change_(send_email,form_data_init_,select_data,dingzhi,inquiry_html,from_yanzheng_,form_data) 1669 1670 1671 data_arr['productID'] = $('#productID').val(); 1672 1673 data_arr = JSON.stringify(data_arr); 1674 1675 //ajaxè¯·æ± 1676 1677 var fn_check; 1678 1679 if (type_ == 'text') { 1680 1681 1682 $('.text_data li select').each(function () { 1683 1684 if ($(this).val() == dingzhi) { 1685 1686 1687 fn_check = false; 1688 } 1689 1690 }) 1691 1692 if ($(object).hasClass('reset_btn')) { 1693 1694 data_arr = {}; 1695 1696 $('.product-summary .text_data > li select').each(function () { 1697 1698 data_arr[$(this).attr('name')] = ''; 1699 1700 }) 1701 data_arr['productID'] = $('#productID').attr('value') 1702 1703 data_arr = JSON.stringify(data_arr); 1704 1705 fn_check = true; 1706 } 1707 1708 1709 } 1710 1711 1712 if ($(this).val() !== dingzhi && fn_check !== false) { 1713 1714 $.ajax({
1715 1716 type: "POST", //Postè¯·æ± 1717 1718 data: data_arr, //æäº¤æ°æ® 1719 1720 async: false, 1721 1722 url: "/wp-admin/admin-ajax.php?action=" + url, //æ¥å£ 1723 1724 success: function (data) { 1725 1726 if (data == '' || data == 'false') { 1727 1728 if (data == 'false') { 1729 alert('This Option Is Not Available, You Can Choose To Customized.') 1730 } 1731 1732 $('.select_img_data_box').slideUp(300, function () { 1733 1734 $('.select_img_data_box').hide(); 1735 1736 $('.select_img_data_box').html(''); 1737 1738 }); 1739 1740 } else { 1741 1742 data = JSON.parse(data) //Jsonæ°æ®è½¬æ¢ 1743 1744 var html_ = [] 1745 1746 if (type_ == 'img') { //å¤æç±»å 1747 1748 1749 $.each(data, function (index, value) { //éåæ¼æ¥html 1750 1751 html_[index] = '<div class="swiper-slide"><a href="' + value + '"class="fancybox"><img src="' + value + '"></a></div>' 1752 1753 }) 1754 1755 html_ = '<div class="select_img_data"><div class="swiper-wrapper_box"><div class="swiper-wrapper">' + html_.join('') + '</div><div class="swiper-button-next swiper-button-white"></div><div class="swiper-button-prev swiper-button-white"></div></div></div>'; 1756 1757 1758 $('.select_img_data_box').html(html_); 1759 1760 $('.select_img_data .fancybox').fancybox(); 1761 1762 $('.select_img_data_box').slideDown(300, function () { 1763 1764 $('.select_img_data_box').show(); 1765 1766 1767 }); 1768 1769 var swiper = new Swiper('.select_img_data .swiper-wrapper_box', { 1770 1771 slidesPerView: 5, 1772 1773 spaceBetween: 10, 1774 1775 watchOverflow: true, 1776 1777 pagination: { 1778 1779 el: '.select_img_data .swiper-pagination', 1780 1781 clickable: true, 1782 1783 }, 1784 1785 navigation: { 1786 1787 nextEl: '.select_img_data .swiper-button-next', 1788 1789 prevEl: '.select_img_data .swiper-button-prev', 1790 1791 }, 1792 1793 breakpoints: { 1794 1366: { 1795 slidesPerView: 3 1796 }, 1797 950: { 1798 slidesPerView: 3 1799 }, 1800 480: { 1801 slidesPerView: 1, 1802 1803 loop: true 1804 } 1805 } 1806 1807 }) 1808 1809 } else if (type_ == 'text') { 1810 1811 index = index - 2; 1812 1813 $('.text_data').find('.Customized_box').remove(); 1814 1815 if ($(object).hasClass('reset_btn')) { 1816 1817 add_change_(send_email) 1818 } 1819 1820 1821 $.each(data, function (num, value) { 1822 1823 var html_ = []; 1824 1825 $.each(value, function (e, object) { 1826 html_[e] = '<option value="' + object + '">' + object + '</option>'; 1827 }) 1828 1829 1830 var a = '<option value="">Please select</option>'; 1831 1832 if ($('.text_data > li').eq(num).find('select option:checked').val() == '' || $(object).hasClass('reset_btn')) { 1833 1834 $('.text_data > li').eq(num).find('select').html(a + html_.join(''));
1835 } else { 1836 1837 $('.text_data > li').eq(num).find('select').html(html_.join('') + a); 1838 1839 } 1840 1841 }) 1842 1843 1844 } 1845 1846 } 1847 1848 if($('.select_img_data').find('img').length > 0){ 1849 1850 $('#imageUrl').val($('.select_img_data').find('img').eq(0).attr('src')) 1851 } 1852 else{ 1853 1854 $('#imageUrl').val($('.cloud-zoom-gallery.item').eq(0).attr('href')) 1855 } 1856 }, 1857 1858 1859 }); 1860 1861 } 1862 1863 1864 }) 1865 1866 } 1867 1868 ajax_data_send('.product-summary .text_data > li select', 'show_data_attributes', 'text', 'change'); 1869 1870 ajax_data_send('.product-summary .img_data > li select', 'show_data_filter', 'img', 'change') 1871 1872 ajax_data_send('.product-summary .text_data > .reset_btn', 'show_data_attributes', 'text', 'click') 1873 1874 $('.btn-add-cart.add-to-cart').on('click', function () { 1875 1876 yanzheng() 1877 }) 1878 1879}) 1880$(function () { 1881 1882 //çæPDFæä»¶ 1883 let download = (object) => { 1884 1885 let element = $(object); // è¿ä¸ªdomå ç´ æ¯è¦å¯¼åºpdfçdivå®¹å¨ 1886 1887 let w = element.width(); // è·å¾è¯¥å®¹å¨ç宽 1888 let h = element.height(); // è·å¾è¯¥å®¹å¨çé« 1889 let offsetTop = element.offset().top; // è·å¾è¯¥å®¹å¨å°ææ¡£é¡¶é¨çè·ç¦» 1890 let offsetLeft = element.offset().left; // è·å¾è¯¥å®¹å¨å°ææ¡£æå·¦çè·ç¦» 1891 let canvas = document.createElement("canvas"); 1892 let abs = 0; 1893 let win_i = $(window).width(); // è·å¾å½åå¯è§çªå£ç宽度ï¼ä¸å 嫿»å¨æ¡ï¼ 1894 let win_o = window.innerWidth; // è·å¾å½åçªå£ç宽度ï¼å 嫿»å¨æ¡ï¼ 1895 1896 if (win_o > win_i) { 1897 abs = (win_o - win_i) / 2; 1898 } 1899 1900 canvas.width = w * 2; 1901 1902 canvas.height = h * 2; 1903 1904 var context = canvas.getContext("2d"); 1905 1906 context.scale(2, 2); 1907 1908 context.translate(-offsetLeft - abs, -offsetTop); 1909 1910 html2canvas(element).then(function (canvas) { 1911 1912 var contentWidth = canvas.width; 1913 1914 var contentHeight = canvas.height; 1915 1916 var pageHeight = contentWidth / 592.28 * 841.89; 1917 1918 var leftHeight = contentHeight; 1919 1920 var position = 0; 1921 //a4纸ç尺寸 1922 var imgWidth = 595.28; 1923 1924 var imgHeight = 592.28 / contentWidth * contentHeight; 1925 1926 var pageData = canvas.toDataURL('image/jpeg', 1.0); 1927 1928 var pdf = new jsPDF('', 'pt', 'a4'); 1929 1930 //æä¸¤ä¸ªé«åº¦éè¦åºåï¼ä¸ä¸ªæ¯html页é¢çå®é é«åº¦ï¼åçæpdfç页é¢é«åº¦(841.89) 1931 //å½å 容æªè¶ è¿pdfä¸é¡µæ¾ç¤ºçèå´ï¼æ éå页 1932 1933 if (leftHeight < pageHeight) { 1934 pdf.addImage(pageData, 'JPEG', 0, 0, imgWidth, imgHeight); 1935 } else { // å页 1936 while (leftHeight > 0) { 1937 1938 pdf.addImage(pageData, 'JPEG', 0, position, imgWidth, imgHeight); 1939 1940 leftHeight -= pageHeight; 1941 1942 position -= 841.89; 1943 //é¿å æ·»å 空ç½é¡µ 1944 if (leftHeight > 0) { 1945 1946 pdf.addPage(); 1947 1948 } 1949 1950 } 1951 1952 } 1953 1954 pdf.save('My-shopping-list.pdf'); 1955 1956 }) 1957 } 1958 1959 $('.qty_delete').each(function (index) { 1960 $(this).click(function () { 1961 var sess = $(this).attr('value') 1962 var data_arr = {'qty_delete': sess} 1963 data_arr = JSON.stringify(data_arr) 1964 $.ajax({
1965 type: "POST", 1966 url: '/wp-admin/admin-ajax.php?action=delete_shopping_cart', 1967 async: false, 1968 data: data_arr, 1969 dataType: "json", 1970 success: function (data) { 1971 location.replace(location) 1972 } 1973 1974 }) 1975 }) 1976 1977 }) 1978 1979 $('.offline').click(function () { 1980 1981 var html_ = '<div class="eshopcart">' + $('.eshopcart').html() + '</div>' 1982 1983 var html_2 = [] 1984 1985 var data_arr2 = {} 1986 1987 $('.eshop.fld2 > span').each(function (index) { 1988 1989 var name = $(this).find('label').text().replace(/^\s*/, "").replace(/\s+/g, "_"); 1990 ; 1991 1992 if ($(this).find('input,select').length > 0) { 1993 1994 var a = $(this).find('input,select').attr('name'); 1995 1996 var b = String($(this).find('input,select').val()); 1997 1998 html_2[index] = '<span><label>' + a + '<span class="reqd">*</span></label><input class="med" disabled type="text" name="" value="' + b + '" id="" maxlength="100" size="40"><br></span>' 1999 2000 data_arr2[a] = b; 2001 2002 } 2003 2004 }) 2005 2006 html_2 = '<div class="eshopcustdetails" style="padding:15px"><fieldset>' + html_2.join('') + '<span><label>information<span class="reqd">*</span></label><input class="med" disabled type="text" name="" value="' + $('#eshop-comments').val() + '" id="" maxlength="100" size="40"><br></span></fieldset></div>' 2007 2008 html_ = '<div id="pdf_box_fd">' + html_ + html_2 + '</div>' 2009 2010 data_arr2['information'] = String($('#eshop-comments').val()) 2011 2012 data_arr2['shipping_cost'] = String($('#s_cost').text() + ' - ' + $('#s_shopping_type').text()) 2013 2014 data_arr2['choose'] = String($('input[name="eshop_shiptype"]:checked').val()) 2015 2016 data_arr2['price'] = $('.amts.lb').text(); 2017 2018 data_arr2['Shipping'] = $('#s_cost').text(); 2019 2020 let area; 2021 2022 if ($(window).width() < 950) { 2023 2024 area = ['90%', '700px'] 2025 } else { 2026 2027 area = ['1200px', '700px'] 2028 } 2029 layer.open({ 2030 title: 'Tips', 2031 content: html_ 2032 , btn: ['Submit', 'Cancel'] 2033 , area: area 2034 , yes: function (index, layero) { 2035 2036 $.ajax({
2037 2038 type: "POST", 2039 2040 url: '/wp-admin/admin-ajax.php?action=add_shopping_cart_inquiry', 2041 2042 async: false, 2043 2044 data: JSON.stringify(data_arr2), 2045 2046 dataType: "json", 2047 2048 success: function (data) { 2049 2050 2051 if(data.status == false || data.status == 'false'){ 2052 2053 layer.open({title:'Tips',content: 'Information not filled in'}); 2054 2055 } 2056 else{ 2057 2058 layer.open({title:'Tips',content: 'Inquiry submitted successfully'}); 2059 2060 } 2061 }, 2062 error: function () { 2063 layer.open({content: 'Server Response Failed'}); 2064 } 2065 2066 }) 2067 2068 } 2069 , btn2: function (index, layero) { 2070 2071 layer.close(index) 2072 2073 } 2074 2075 }) 2076 }) 2077 2078 //[] 2079 2080 2081}) 2082 2083$(function(){ 2084 2085 2086 2087 if($('.img_data').find('li').length < 1){ 2088 2089 $('.reset_btn').remove(); 2090 } 2091}) 2092 2093$(function(){ 2094 $('.orderlist .fancybox').fancybox() 2095 2096}) 2097
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.