1"use strict"; 2 3var $document = $(document), 4 $window = $(window), 5 $body = $('body'), 6 $html = $('html'), 7 $ttPageContent = $('#tt-pageContent'), 8 $ttFooter = $('footer'), 9 $ttHeader = $('header'), 10 $ttLeftColumnAside = $ttPageContent.find('.leftColumn.aside'), 11 $ttFilterOptions = $ttPageContent.find('.tt-filters-options'), 12 13 /* menu setting*/ 14 header_menu_timeout = 200, 15 header_menu_delay = 200, 16 17 //header 18 $ttTopPanel = $('.tt-top-panel'), 19 //header stuck 20 $stucknav = $ttHeader.find('.tt-stuck-nav'), 21 //header menu 22 $ttDesctopMenu = $ttHeader.find('.tt-desctop-menu'), 23 $ttDesctopParentMenu = $ttHeader.find('.tt-desctop-parent-menu'), 24 $ttMobileParentMenu = $ttHeader.find('.tt-mobile-parent-menu'), 25 $ttMobileParentMenuChildren = $ttMobileParentMenu.children(), 26 $ttStuckParentMenu = $ttHeader.find('.tt-stuck-parent-menu'), 27 //header search 28 $ttSearchObj = $ttHeader.find('.tt-search'), 29 $ttDesctopParentSearch = $ttHeader.find('.tt-desctop-parent-search'), 30 $ttMobileParentSearch = $ttHeader.find('.tt-mobile-parent-search'), 31 $ttStuckParentSearch = $ttHeader.find('.tt-stuck-parent-search'), 32 //header cart 33 $ttcartObj = $ttHeader.find('.tt-cart'), 34 $ttDesctopParentCart = $ttHeader.find('.tt-desctop-parent-cart'), 35 $ttMobileParentCart = $ttHeader.find('.tt-mobile-parent-cart'), 36 $ttStuckParentCart = $ttHeader.find('.tt-stuck-parent-cart'), 37 //header account 38 $ttAccountObj = $ttHeader.find('.tt-account'), 39 $ttDesctopParentAccount = $ttHeader.find('.tt-desctop-parent-account'), 40 $ttMobileParentAccount = $ttHeader.find('.tt-mobile-parent-account'), 41 $ttStuckParentAccount = $ttHeader.find('.tt-stuck-parent-account'), 42 //header langue and currency(*all in one module) 43 $ttMultiObj = $ttHeader.find('.tt-multi-obj'), 44 $ttDesctopParentMulti = $ttHeader.find('.tt-desctop-parent-multi'), 45 $ttMobileParentMulti = $ttHeader.find('.tt-mobile-parent-multi'), 46 $ttStuckParentMulti = $ttHeader.find('.tt-stuck-parent-multi'), 47 48 49 // Template Blocks 50 blocks = { 51 ttCalendarDatepicker: $ttPageContent.find('.calendarDatepicker'), 52 ttSliderBlog: $ttPageContent.find('.tt-slider-blog'), 53 ttSlickMain: $ttPageContent.find('.tt-slick-main'), 54 ttSliderBlogSingle: $ttPageContent.find('.tt-slider-blog-single'), 55 ttVideoBlock: $('.tt-video-block'), 56 ttBlogMasonry: $ttPageContent.find('.tt-blog-masonry'), 57 ttPortfolioMasonry: $ttPageContent.find('.tt-portfolio-masonry'), 58 ttProductMasonry: $ttPageContent.find('.tt-product-listing-masonry'), 59 ttInputCounter: $('.tt-input-counter'), 60 ttCollapseBlock: $('.tt-collapse-block'), 61 modalVideoProduct: $('#modalVideoProduct'), 62 modalAddToCart: $('#modalAddToCartProduct'), 63 ttMobileProductSlider: $('.tt-mobile-product-slider'), 64 ttCollapse: $ttPageContent.find('.tt-collapse'), 65 ttProductListing: $ttPageContent.find('.tt-product-listing'), 66 ttBtnColumnClose: $ttLeftColumnAside.find('.tt-btn-col-close'), 67 ttBtnToggle: $ttFilterOptions.find('.tt-btn-toggle a'), 68 ttBtnAddProduct: $ttPageContent.find('.tt_product_showmore'), 69 ttProductItem: $ttPageContent.find('.tt-product, .tt-product-design02'), 70 ttProductDesign02: $ttPageContent.find('.tt-product-design02'), 71 ttProductDesign01: $ttPageContent.find('.tt-product'), 72 ttFilterDetachOption: $ttLeftColumnAside.find('.tt-filter-detach-option'), 73 ttFilterSort: $ttFilterOptions.find('.tt-sort'), 74 ttShopCart: $ttPageContent.find('.tt-shopcart-table, .tt-shopcart-table-02'), 75 ttSliderLookbook: $ttPageContent.find('.tt-slider-lookbook'), 76 ttPortfolioContent: $ttPageContent.find('.tt-portfolio-content'), 77 ttLookbook: $ttPageContent.find('.tt-lookbook'), 78 ttAirSticky: $ttPageContent.find('.airSticky'), 79 ttfooterMobileCollapse: $ttFooter.find('.tt-collapse-title'), 80 ttBackToTop: $('.tt-back-to-top'), 81 ttHeaderDropdown: $ttHeader.find('.tt-dropdown-obj'), 82 mobileMenuToggle: $('.tt-menu-toggle'), 83 ttCarouselProducts: $('.tt-carousel-products'), 84 ttItemsCategories: $ttPageContent.find('.tt-items-categories'), 85 ttDotsAbsolute: $ttPageContent.find('.tt-dots-absolute'), 86 ttAlignmentImg: $ttPageContent.find('.tt-alignment-img'), 87 ttProductSingleBtnZomm: $ttPageContent.find('.tt-product-single-img .tt-btn-zomm'), 88 ttRevolutionPromo: $ttPageContent.find('.tt-revolution-promo'), 89 }; 90 91var ttwindowWidth = window.innerWidth || $window.width(); 92 93 94if (blocks.ttRevolutionPromo.length) { 95 setTimeout(function(){ 96 blocks.ttRevolutionPromo.fadeTo("90", 1); 97 }, 2300); 98 blocks.ttRevolutionPromo.on('click', '.tt-btn-close', function() { 99 $(this).closest('.tt-revolution-promo').hide(); 100 }); 101}; 102 103if (blocks.ttItemsCategories.length) { 104 ttItemsCategories(); 105}; 106if (blocks.modalAddToCart.length) { 107 modalAddToCart(); 108}; 109// Mobile Menu 110if ($('.mainmenumob-js').length) { 111 $('.mainmenumob-js').initMM({ 112 enable_breakpoint: true, 113 mobile_button: true, 114 breakpoint: 1025, 115 menu_class: 'mobile-main-menu', 116 close_button_name: b_close, 117 back_button_name: b_back 118 }); 119}; 120//header top panel 121if ($ttTopPanel.length) {
122 ttTopPanel(); 123}; 124// add product item 125if (blocks.ttBackToTop.length) { 126 ttBackToTop(); 127}; 128// Slide Column *listing-left-column.html 129if ($ttLeftColumnAside && blocks.ttBtnColumnClose && blocks.ttBtnToggle) { 130 ttToggleCol(); 131}; 132if (blocks.ttCollapse.length) { 133 ttCollapse(); 134}; 135//modal video on page product 136if (blocks.modalVideoProduct.length) { 137 ttVideoPopup(); 138}; 139//calendarDatepicker(blog) 140if (blocks.ttCalendarDatepicker.length) { 141 blocks.ttCalendarDatepicker.datepicker(); 142}; 143//video(blog listing) 144if (blocks.ttVideoBlock.length) { 145 ttVideoBlock(); 146}; 147// determination ie 148if (getInternetExplorerVersion() !== -1) { 149 $html.addClass("ie"); 150}; 151// inputCounter 152if (blocks.ttInputCounter.length) { 153 ttInputCounter(); 154}; 155// header 156initStuck(); 157if ($ttDesctopParentSearch.length) { 158 mobileParentSearch(); 159}; 160if ($ttcartObj.length) { 161 mobileParentCart(); 162}; 163if ($ttDesctopParentAccount.length) { 164 mobileParentAccount(); 165}; 166if ($ttDesctopParentMulti.length) { 167 mobileParentMulti(); 168}; 169// product item Design01 170if (blocks.ttProductDesign01.length || $('.tt-product-single-info').length || $('.wkpageinfo').length) { 171 ttProductHover(); 172}; 173if (blocks.ttfooterMobileCollapse.length) { 174 ttFooterCollapse(); 175}; 176// lookbook.html 177if (blocks.ttLookbook.length) { 178 ttLookbook(ttwindowWidth); 179}; 180// shopping_cart.html 181if (blocks.ttShopCart.length) { 182 ttShopCart(ttwindowWidth); 183}; 184// carusel 185if (blocks.ttCarouselProducts.length) { 186 blocks.ttCarouselProducts.each( function() { 187 var slick = $(this), 188 item = $(this).data('item'); 189 slick.slick({ 190 dots: false, 191 arrows: true, 192 infinite: true, 193 speed: 300, 194 slidesToShow: item || 4, 195 slidesToScroll: item || 4, 196 adaptiveHeight: true, 197 responsive: [{ 198 breakpoint: 1025, 199 settings: { 200 slidesToShow: 3, 201 slidesToScroll: 3 202 } 203 }, 204 { 205 breakpoint: 791, 206 settings: { 207 slidesToShow: 2, 208 slidesToScroll: 2 209 } 210 }] 211 }); 212 }); 213}; 214// lookbook.html 215// slider 216if (blocks.ttSliderLookbook.length) { 217 blocks.ttSliderLookbook.slick({ 218 dots: true, 219 arrows: true, 220 infinite: true, 221 speed: 300, 222 slidesToShow: 1, 223 adaptiveHeight: true 224 }); 225}; 226 227//blog listing slider 228$(document).ready(function(){ 229 if (blocks.ttMobileProductSlider.length) { 230 if($(window).width() < 576){ 231 initttMobileProductSlider(); 232 } 233 else{ 234 $(window).bind('resize.ttmobpr', initttMobileProductSlider); 235 } 236 }; 237 function initttMobileProductSlider(){ 238 $(window).unbind('resize.ttmobpr'); 239 blocks.ttMobileProductSlider.on('init', function(event, slick){ 240 var event = new CustomEvent('mobile-slider-initialized', { 'detail': $(this) }); 241 window.dispatchEvent(event); 242 }); 243 var d = blocks.ttMobileProductSlider.attr('data-slickdots') == 'true' ? true : false; 244 blocks.ttMobileProductSlider.slick({ 245 lazyLoad: 'progressive', 246 dots: d, 247 arrows: true, 248 infinite: false, 249 speed: 300, 250 slidesToShow: 1, 251 slidesToScroll: 1, 252 adaptiveHeight: true 253 }); 254 } 255}) 256//slick main (* index-14.html) 257if (blocks.ttSlickMain.length) { 258 blocks.ttSlickMain.slick({ 259 dots: true, 260 arrows: true, 261 infinite: true, 262 speed: 300, 263 slidesToShow: 1, 264 adaptiveHeight: true, 265 responsive: [{ 266 breakpoint: 1025, 267 settings: { 268 dots: false, 269 } 270 }] 271 }); 272}; 273//blog listing slider 274if (blocks.ttSliderBlog.length) { 275 blocks.ttSliderBlog.slick({ 276 dots: false, 277 arrows: true, 278 infinite: true, 279 speed: 300, 280 slidesToShow: 1, 281 adaptiveHeight: true 282 }); 283}; 284//blog single post slider 285if (blocks.ttSliderBlogSingle.length) { 286 blocks.ttSliderBlogSingle.slick({ 287 dots: false, 288 arrows: false, 289 infinite: true, 290 speed: 300, 291 slidesToShow: 1, 292 adaptiveHeight: true 293 }); 294 //total slides 295 var ttSlickQuantity = $('.tt-slick-quantity'); 296 if (ttSlickQuantity.length) { 297 ttSlickQuantity.find('.total').html(blocks.ttSliderBlogSingle.slick("getSlick").slideCount); 298 blocks.ttSliderBlogSingle.on('afterChange', function(event, slick, currentSlide){ 299 var currentIndex = $('.slick-current').attr('data-slick-index'); 300 currentIndex++; 301 ttSlickQuantity.find('.account-number').html(currentIndex); 302 }); 303 }; 304 //button 305 var ttSlickButton = $('.tt-slick-button'); 306 if (ttSlickButton.length) { 307 ttSlickButton.find('.slick-next').click(function(){ 308 blocks.ttSliderBlogSingle.slick('slickNext'); 309 }); 310 ttSlickButton.find('.slick-prev').click(function(){ 311 blocks.ttSliderBlogSingle.slick('slickPrev'); 312 }); 313 }; 314}; 315 316 317 318 319// portfolio mobile click
320if (blocks.ttPortfolioContent.length && is_touch_device()) { 321 ttPortfolioContentMobile(); 322}; 323if (blocks.ttDotsAbsolute.length) { 324 ttSlickDots(); 325}; 326//sticky(product-05.html) 327if (blocks.ttAirSticky.length) { 328 ttAirSticky(ttwindowWidth); 329}; 330// header - tt-dropdown-obj 331if (blocks.ttHeaderDropdown.length) { 332 ttHeaderDropdown(); 333}; 334 335// product single tt-btn-zomm(*magnific popup) 336if (blocks.ttProductSingleBtnZomm.length) { 337 ttProductSingleBtnZomm(); 338}; 339 340$window.on('load', function () { 341 var ttwindowWidth = window.innerWidth || $window.width(); 342 if ($body.length) { 343 $body.addClass('loaded'); 344 }; 345 // filters options product(definition layout) 346 if ($ttFilterOptions.length) { 347 ttFilterLayout(ttwindowWidth); 348 }; 349 if (blocks.ttProductItem.length) { 350 ttProductSmall(ttwindowWidth); 351 }; 352 if (blocks.ttProductDesign02.length) { 353 ttOverflowProduct(); 354 }; 355 // centering arrow 356 if (blocks.ttAlignmentImg.length) { 357 alignmentArrowValue(); 358 }; 359 if (blocks.ttProductMasonry.length) { 360 gridProductMasonr(); 361 }; 362 if (blocks.ttBlogMasonry.length) { 363 gridGalleryMasonr(); 364 }; 365 if (blocks.ttPortfolioMasonry.length) { 366 gridPortfolioMasonr(); 367 initPortfolioPopup(); 368 }; 369}); 370 371var ttCachedWidth = $window.width(); 372$window.on('resize', function () { 373 var newWidth = $window.width(); 374 if(newWidth !== ttCachedWidth){ 375 ttCachedWidth = newWidth; 376 377 378 var ttwindowWidth = window.innerWidth || $window.width(); 379 380 // shopping_cart.html 381 if (blocks.ttShopCart.length) { 382 ttShopCart(ttwindowWidth); 383 }; 384 // filters options product(definition layout) 385 if ($ttFilterOptions.length) { 386 ttFilterLayout(ttwindowWidth); 387 }; 388 if (blocks.ttProductItem.length) { 389 ttProductSmall(); 390 }; 391 if (blocks.ttProductDesign02.length) { 392 ttOverflowProduct(); 393 }; 394 // portfolio mobile click 395 if (blocks.ttPortfolioContent.length && is_touch_device()) { 396 ttPortfolioContentMobile(); 397 }; 398 //sticky(product-05.html) 399 if (blocks.ttAirSticky.length) { 400 ttAirSticky(ttwindowWidth); 401 }; 402 if ($ttLeftColumnAside.hasClass('column-open') && $ttLeftColumnAside.length) { 403 $ttLeftColumnAside.find('.tt-btn-col-close a').trigger('click'); 404 }; 405 406 //header init stuck and detach 407 if ($ttDesctopParentSearch.length) { 408 mobileParentSearch(); 409 }; 410 if ($ttcartObj.length) { 411 mobileParentCart(); 412 }; 413 if ($ttDesctopParentAccount.length) { 414 mobileParentAccount(); 415 }; 416 if ($ttDesctopParentMulti.length) { 417 mobileParentMulti(); 418 }; 419 if (blocks.ttDotsAbsolute.length) { 420 ttSlickDots(); 421 }; 422 // centering arrow 423 if (blocks.ttAlignmentImg.length) { 424 alignmentArrowValue(); 425 }; 426 } 427}); 428// Functions 429var cssFix = function() { 430 var u = navigator.userAgent.toLowerCase(), 431 is = function(t) { 432 return (u.indexOf(t) != -1) 433 }; 434 $html.addClass([ 435 (!(/opera|webtv/i.test(u)) && /msie (\d)/.test(u)) ? ('ie ie' + RegExp.$1) : 436 is('firefox/2') ? 'gecko ff2' : 437 is('firefox/3') ? 'gecko ff3' : 438 is('gecko/') ? 'gecko' : 439 is('opera/9') ? 'opera opera9' : /opera (\d)/.test(u) ? 'opera opera' + RegExp.$1 : 440 is('konqueror') ? 'konqueror' : 441 is('applewebkit/') ? 'webkit safari' : 442 is('mozilla/') ? 'gecko' : '', 443 (is('x11') || is('linux')) ? ' linux' : 444 is('mac') ? ' mac' : 445 is('win') ? ' win' : '' 446 ].join('')); 447}(); 448 449function ttTopPanel(){ 450 $ttTopPanel.on('click', function(e) { 451 e.preventDefault; 452 var target = e.target; 453 if ($('.tt-btn-close').is(target)){ 454 $(this).slideUp(200); 455 }; 456 }); 457}; 458 459//tabs init carusel 460$('a[data-toggle="tab"]').length && $('body').on('shown.bs.tab', 'a[data-toggle="tab"]', function (e) { 461 $('.slick-slider').each(function() { 462 $(this).slick("getSlick").refresh(); 463 }); 464 if (blocks.ttAlignmentImg.length) { 465 alignmentArrowValue(); 466 }; 467}); 468$('.modal').on('shown.bs.modal', function (e) { 469 var objSlickSlider = $(this).find('.slick-slider'); 470 if(objSlickSlider.length){ 471 objSlickSlider.each(function() { 472 $(this).slick("getSlick").refresh(); 473 }); 474 }; 475}); 476function ttItemsCategories(){ 477 blocks.ttItemsCategories.hover(function() { 478 $(this).toggleClass('active'); 479 }); 480}; 481function ttHeaderDropdown(){ 482 var dropdownPopup = $('.header-popup-bg'); 483 if(!dropdownPopup.length){ 484 $body.append('<div class="header-popup-bg"></div>'); 485 }; 486 $('header').on('click', '.tt-dropdown-obj', function(e) { 487 var ttwindowWidth = window.innerWidth || $window.width(), 488 $this = $(this), 489 target = e.target, 490 objSearch = $('.tt-search'), 491 objSearchInput = objSearch.find('.tt-search-input'); 492 493 // search 494 if ($this.hasClass('tt-search') && $('.tt-dropdown-toggle').is(target)){ 495 searchPopup(); 496 }; 497 function searchPopup(){ 498 $('body').addClass('tt-open-search'); 499 $this.addClass('active'); 500 setTimeout(function(){objSearchInput.focus();}, 150) 501 return false;
502 }; 503 if (objSearch.find('.tt-btn-close').is(target)){ 504 objSearchClose(); 505 return false; 506 }; 507 function objSearchClose(){ 508 $('body').removeClass('tt-open-search'); 509 $this.removeClass('active'); 510 objSearchInput.blur(); 511 return false; 512 }; 513 514 // cart, account, multi-ob 515 if (!$(this).hasClass('tt-search') && $('.tt-dropdown-toggle').is(target)){ 516 ttwindowWidth <= 1024 ? popupObjMobile($this) : popupObjDesctop($this); 517 }; 518 function popupObjMobile(obj){ 519 $('header').find('.tt-dropdown-obj.active').removeClass('active'); 520 obj.toggleClass('activetoview'); 521 setTimeout(function(){ 522 obj.toggleClass('active').find('.tt-dropdown-menu').removeAttr("style"); 523 $body.toggleClass('tt-popup-dropdown'); 524 $('header .tt-cart .tt-dropdown-menu').perfectScrollbar().addClass('perfectScrollbar');/* cart * / */ 525 }, 50) 526 }; 527 function popupObjDesctop(obj){ 528 var $this = obj, 529 target = e.target; 530 531 if ($this.hasClass('active')){ 532 $this.toggleClass('active').find('.tt-dropdown-menu').slideToggle(200); 533 $this.find('.ps-container').removeAttr("style");/* cart * / */ 534 return; 535 }; 536 $('.tt-desktop-header .tt-dropdown-obj').each( function () { 537 var $this = $(this); 538 if($this.hasClass('active')){ 539 $this.removeClass('active').find('.tt-dropdown-menu').css("display", "none"); 540 } 541 }); 542 if ($('.tt-dropdown-toggle').is(target)){ 543 toggleDropdown($this); 544 }; 545 if($this.hasClass('tt-cart')){/* cart * / */ 546 $.fn.getRealDimensions = function (outer){ 547 var $this = $(this); 548 if ($this.length == 0) { 549 return false; 550 } 551 var $clone = $this.clone() 552 .show() 553 .css('visibility','hidden') 554 .insertAfter($this); 555 var result = { 556 width: (outer) ? $clone.outerWidth() : $clone.innerWidth(), 557 height: (outer) ? $clone.outerHeight() : $clone.innerHeight(), 558 offsetTop: $clone.offset().top, 559 offsetLeft: $clone.offset().left 560 }; 561 $clone.remove(); 562 return result; 563 }; 564 565 var dimensions = $('.tt-cart-content').getRealDimensions().height, 566 viewportHeight = window.innerHeight, 567 cartPopup = dimensions + $('.tt-desktop-header').height(), 568 stuckNav = $('.tt-stuck-nav'); 569 570 if(stuckNav.hasClass('stuck')){ 571 var insertValue = viewportHeight - stuckNav.height(); 572 } else{ 573 var insertValue = viewportHeight - $('.tt-desktop-header').height(); 574 }; 575 576 if(viewportHeight <= cartPopup){ 577 $('header .tt-dropdown-menu .tt-cart-layout').css({ 578 'height' : insertValue + 'px' 579 }).perfectScrollbar().addClass('perfectScrollbar'); 580 }; 581 $(window).resize(debouncer(function(e){ 582 var ttCart = $('.tt-cart'); 583 if(ttCart.hasClass('active')){ 584 $('.tt-cart .tt-dropdown-toggle').trigger('click'); 585 }; 586 })); 587 } 588 }; 589 function toggleDropdown(obj){ 590 obj.toggleClass('active').find('.tt-dropdown-menu').slideToggle(200); 591 }; 592 593 $(document).mouseup(function(e){ 594 var ttwindowWidth = window.innerWidth || $window.width(); 595 596 if (!$this.is(e.target) && $this.has(e.target).length === 0){ 597 $this.each(function(){ 598 if($this.hasClass('active') && $this.hasClass('tt-search')){ 599 objSearch.find('.tt-btn-close').trigger('click'); 600 }; 601 if($this.hasClass('active') && !$this.hasClass('tt-search')){ 602 if(ttwindowWidth <= 1024){ 603 closeObjPopupMobile(); 604 } else { 605 $('.tt-dropdown-obj').each( function () { 606 if($(this).hasClass('active')){ 607 $(this).removeClass('active').find('.tt-dropdown-menu').css("display", "none"); 608 } 609 }); 610 }; 611 }; 612 }); 613 }; 614 if ($this.find('.tt-mobile-add .tt-close').is(e.target)){ 615 closeObjPopupMobile(); 616 }; 617 }); 618 function closeObjPopupMobile(){ 619 $('.tt-dropdown-obj.active').removeClass('active') 620 $('.tt-dropdown-obj.activetoview').length && setTimeout(function(){$('.tt-dropdown-obj.activetoview').removeClass('activetoview');}, 200) 621 $body.removeClass('tt-popup-dropdown'); 622 return false;
623 }; 624 }); 625}; 626 627// button back to top 628function ttBackToTop() { 629 blocks.ttBackToTop.on('click', function(e) { 630 $('html, body').animate({ 631 scrollTop: 0 632 }, 500); 633 return false; 634 }); 635 $window.scroll(function() { 636 $window.scrollTop() > 500 ? blocks.ttBackToTop.stop(true.false).addClass('tt-show') : blocks.ttBackToTop.stop(true.false).removeClass('tt-show'); 637 }); 638}; 639 640// modal Add ToCart(*close) 641function modalAddToCart() { 642 blocks.modalAddToCart.on('click', '.btn-close-popup', function(e) { 643 $(this).closest('.modal-content').find('.modal-header .close').trigger('click'); 644 return false; 645 }); 646}; 647 648// Mobile footer collapse 649function ttFooterCollapse() { 650 blocks.ttfooterMobileCollapse.on('click', function(e) { 651 e.preventDefault; 652 $(this).toggleClass('tt-open'); 653 }); 654}; 655 656//slick slider functional for dots 657function ttSlickDots() { 658 blocks.ttDotsAbsolute.each(function(){ 659 var $this = $(this).find('.slick-dots'); 660 if($this.is(':visible')){ 661 var upperParent = $this.closest('[class ^= container]'); 662 if (upperParent.length){ 663 upperParent.css({'paddingBottom' : parseInt($this.height(), 10) + parseInt($this.css('marginTop'), 10)}); 664 } 665 } 666 }); 667}; 668// product item Design01 hover (*desctope) 669function ttProductHover() { 670 $document.on('mouseenter mouseleave', '#tt-pageContent .tt-product', function(e) { 671 if($('.tt-product-listing').length && $('.tt-product-listing').hasClass("tt-col-one")) return false; 672 673 var $this = $(this), 674 windW = window.innerWidth, 675 objLiftUp01 = $this.find('.tt-description'), 676 objLiftUp02 = $this.find('.tt-product-inside-hover'), 677 objHeight02 = parseInt(objLiftUp02.height())+3, 678 objCountdown = $this.find('.tt-countdown_box'), 679 target = e.target; 680 681 if($this.hasClass('product-nohover')) return false; 682 683 if (e.type === 'mouseenter' && windW > 1024) { 684 ttOnHover(); 685 } else if (e.type === 'mouseleave' && e.relatedTarget && windW > 1024) { 686 ttOffHover(); 687 }; 688 689 function ttOnHover(e){ 690 $this.stop().css({ 691 height: $this.innerHeight() 692 }).addClass('hovered'); 693 objLiftUp01.stop().animate({'top': '-' + objHeight02}, 200); 694 objLiftUp02.stop().animate({ 'opacity': 1 }, 400); 695 objCountdown.stop().animate({'bottom': objHeight02}, 200); 696 return false; 697 }; 698 function ttOffHover(e){ 699 $this.stop().removeClass('hovered').removeAttr('style'); 700 objLiftUp01.stop().animate({'top': '0'}, 200, function(){$(this).removeAttr('style')}); 701 objLiftUp02.stop().animate({ 'opacity': 0 }, 100, function(){$(this).removeAttr('style')}); 702 objCountdown.stop().animate({'bottom': 0}, 200, function(){$(this).removeAttr('style')}); 703 return false 704 }; 705 }); 706}; 707 708// shopping_cart.html 709function ttShopCart(ttwindowWidth) { 710 var desctopQuantity = blocks.ttShopCart.find(".detach-quantity-desctope"), 711 mobileQuantity = blocks.ttShopCart.find(".detach-quantity-mobile"); 712 713 ttwindowWidth <= 789 ? insertDesctopeObj() : insertMobileObj(); 714 715 function insertDesctopeObj(){ 716 desctopQuantity.each(function(){ 717 var objDesctope = $(this).find('.tt-input-counter').detach().get(0); 718 $(this).closest('tr').find('.detach-quantity-mobile').append(objDesctope); 719 }) 720 }; 721 function insertMobileObj(){ 722 mobileQuantity.each(function(){ 723 var objMobile = $(this).find('.tt-input-counter').detach().get(0); 724 $(this).closest('tr').find('.detach-quantity-desctope').append(objMobile); 725 }) 726 }; 727}; 728 729// product Small 730function ttProductSmall(){ 731 var currentW = parseInt(blocks.ttProductItem.width(), 10), 732 objProduct = $(".tt-product, .tt-product-design02"); 733 currentW <= 210 ? objProduct.addClass("tt-small") : objProduct.removeClass("tt-small"); 734}; 735 736function debouncer(func, timeout) { 737 var timeoutID, timeout = timeout || 500; 738 return function() { 739 var scope = this, 740 args = arguments; 741 clearTimeout(timeoutID); 742 timeoutID = setTimeout(function() { 743 func.apply(scope, Array.prototype.slice.call(args)); 744 }, timeout); 745 } 746}; 747 748// centering arrow 749function alignmentArrowValue(){ 750 if(!$ttPageContent.find('.tt-alignment-img').length) return false;
751 752 var ttwindowWidth = window.innerWidth || $window.width(); 753 754 if(ttwindowWidth > 1024){ 755 setTimeout(function() { 756 $ttPageContent.find('.tt-alignment-img').each(function() { 757 $(this).find('.slick-arrow').removeAttr("style"); 758 }); 759 }, 225); 760 } else { 761 setTimeout(function() { 762 $ttPageContent.find('.tt-alignment-img').each(function() { 763 var ttObj = $(this), 764 $objParentArrow = ttObj.find('.slick-arrow'); 765 if(ttObj.find('.tt-image-box').length == 0 || $objParentArrow.length == 0) return; 766 var $obj = ttObj.find('.tt-image-box').first(); 767 $objParentArrow.css({ 768 'top' : $obj.findHeight() - $objParentArrow.findHeight() - parseInt(ttObj.css('marginTop'), 10) + 'px' 769 }); 770 771 ttObj.find('.tt-product').length && ttProductSmall(); 772 }); 773 }, 225); 774 }; 775 776}; 777$.fn.findHeight = function (){ 778 var $blocks = $(this), 779 maxH = $blocks.eq(0).innerHeight(); 780 781 $blocks.each(function(){ 782 maxH = ( $(this).innerHeight() > maxH ) ? $(this).innerHeight() : maxH; 783 }); 784 785 return maxH/2; 786}; 787// tt-hotspot 788function ttLookbook(ttwindowWidth){ 789 //add lookbook popup 790 var objPopup = $('.tt-lookbook-popup'); 791 if(!objPopup.length){ 792 $body.append('<div class="tt-lookbook-popup"><div class="tt-lookbook-container"></div></div>'); 793 }; 794 795 var events = 'ontouchstart' in window ? "click" : "mouseenter"; 796 blocks.ttLookbook.on(events, '.tt-hotspot' , function(e) { 797 $(this).hasClass('emptycontent') ? loadHotspotContent(this, e) : showMessage(this, e); 798 }); 799 function loadHotspotContent(_this, e){ 800 var $this = $(_this), 801 lurl = '/products/'+$(_this).attr('data-prhandle')+'?view=getproductlookbook'; 802 $this.removeClass('emptycontent'); 803 var params = { 804 type: "get", 805 url: lurl, 806 success: function(data) { 807 $this.find('.tt-content-parent').append(data); 808 setTimeout(showMessage(_this, e), 200); 809 } 810 }; 811 jQuery.ajax(params); 812 } 813 function showMessage(_this, e){ 814 var $this = $(_this), 815 target = e.target, 816 ttHotspot = $('.tt-hotspot'), 817 ttwindowWidth = window.innerWidth || $window.width(), 818 ttCenterBtn = $('.tt-btn').innerHeight() / 2, 819 ttWidthPopup = $('.tt-hotspot-content').innerWidth(); 820 821 822 ttwindowWidth <= 789 ? ttLookbookMobile($this) : ttLookbookDesktop($this); 823 824 //ttLookbookDesktop 825 function ttLookbookDesktop($this){ 826 827 if ($this.hasClass('active')) return; 828 829 var objTop = $this.offset().top + ttCenterBtn, 830 objLeft = $this.offset().left, 831 objContent = $this.find('.tt-hotspot-content').detach(); 832 833 //check if an open popup 834 var checkChildren = $('.tt-lookbook-container').children().size(); 835 if(checkChildren > 0){ 836 if(ttwindowWidth <= 789){ 837 closePopupMobile(); 838 } else { 839 closePopupDesctop(); 840 }; 841 } 842 843 //open popup 844 popupOpenDesktop(objContent, objTop, objLeft); 845 846 }; 847 function popupOpenDesktop(objContent, objTop, objLeft){ 848 //check out viewport(left or right) 849 var halfWidth = ttwindowWidth / 2, 850 objLeftFinal = 0; 851 852 if(halfWidth < objLeft){ 853 objLeftFinal = objLeft - ttWidthPopup - 7; 854 popupShowLeft(objLeftFinal); 855 } else{ 856 objLeftFinal = objLeft + 45; 857 popupShowRight(objLeftFinal); 858 }; 859 860 $('.tt-lookbook-popup').find('.tt-lookbook-container').append(objContent); 861 $this.addClass('active').siblings().removeClass('active'); 862 863 function popupShowLeft(objLeftFinal){ 864 $('.tt-lookbook-popup').css({ 865 'top' : objTop, 866 'left' : objLeftFinal, 867 'display' : 'block' 868 }, 300).animate({ 869 marginLeft: 26 + 'px', 870 opacity: 1 871 }, 300); 872 }; 873 function popupShowRight(objLeftFinal){ 874 $('.tt-lookbook-popup').css({ 875 'top' : objTop, 876 'left' : objLeftFinal, 877 'display' : 'block' 878 }).animate({ 879 marginLeft: -26 + 'px', 880 opacity: 1 881 }); 882 }; 883 }; 884 //ttLookbookMobile 885 function ttLookbookMobile($this){ 886 var valueTop = $this.attr('data-top') + '%', 887 valueLeft = $this.attr('data-left') + '%'; 888 889 $this.find('.tt-btn').css({ 890 'top' : valueTop, 891 'left' : valueLeft 892 }); 893 $this.css({ 894 'top' : '0px', 895 'left' : '0px', 896 'width' : '100%', 897 'height' : '100%' 898 }); 899 $this.addClass('active').siblings().removeClass('active'); 900 $this.find('.tt-content-parent').fadeIn(200); 901 }; 902 //Close mobile 903 if(ttwindowWidth <= 789){ 904 if ($('.tt-btn-close').is(e.target)){ 905 e.preventDefault(); 906 closePopupMobile(); 907 return false;
908 }; 909 if ($('.tt-hotspot').is(e.target)){ 910 closePopupMobile(); 911 }; 912 $(document).mouseup(function(e){ 913 if (!$('.tt-lookbook-popup').is(e.target) && $('.tt-lookbook-popup').has(e.target).length === 0 && !$('.tt-hotspot').is(e.target) && $('.tt-hotspot').has(e.target).length === 0){ 914 closePopupDesctop(); 915 }; 916 }); 917 }; 918 //Close desctope 919 if(ttwindowWidth > 789){ 920 //ttLookbookClose 921 $(document).mouseup(function(e){ 922 var ttwindowWidth = window.innerWidth || $window.width(); 923 if ($('.tt-btn-close').is(e.target)){ 924 closePopupDesctop(); 925 return false; 926 }; 927 if (!$('.tt-lookbook-popup').is(e.target) && $('.tt-lookbook-popup').has(e.target).length === 0 && !$('.tt-hotspot').is(e.target) && $('.tt-hotspot').has(e.target).length === 0){ 928 closePopupDesctop(); 929 }; 930 }); 931 }; 932 933 function closePopupDesctop(){ 934 //detach content popup 935 var detachContentPopup = $('.tt-lookbook-popup').removeAttr("style").find('.tt-hotspot-content').detach(); 936 $('.tt-hotspot.active').removeClass('active').find('.tt-content-parent').append(detachContentPopup); 937 }; 938 function closePopupMobile(){ 939 if($('.tt-lookbook-container').is(':has(div)')){ 940 var checkPopupContent = $('.tt-lookbook-container').find('.tt-hotspot-content').detach(); 941 $('.tt-hotspot.active').find('.tt-content-parent').append(checkPopupContent); 942 }; 943 $('.tt-lookbook').find('.tt-hotspot.active').each(function(index) { 944 var $this = $(this), 945 valueTop = $this.attr('data-top') + '%', 946 valueLeft = $this.attr('data-left') + '%'; 947 948 $this.removeClass('active').removeAttr("style").css({ 949 'top' : valueTop, 950 'left' : valueLeft, 951 }).find('.tt-btn').removeAttr("style").next().removeAttr("style"); 952 }); 953 }; 954 function checkclosePopupMobile(){ 955 $('.tt-hotspot').find('.tt-content-parent').each(function() { 956 var $this = $(this); 957 if($this.css('display') == 'block'){ 958 var $thisParent = $this.closest('.tt-hotspot'), 959 valueTop = $thisParent.attr('data-top') + '%', 960 valueLeft = $thisParent.attr('data-left') + '%'; 961 962 $this.removeAttr("style").prev().removeAttr("style"); 963 $thisParent.removeAttr("style").css({ 964 'top' : valueTop, 965 'left' : valueLeft, 966 }); 967 }; 968 }); 969 }; 970 $(window).resize(debouncer(function(e) { 971 var ttwindowWidth = window.innerWidth || $window.width(); 972 if(ttwindowWidth <= 789){ 973 closePopupMobile(); 974 } else { 975 closePopupDesctop(); 976 checkclosePopupMobile(); 977 }; 978 })); 979 // return false; 980 }; 981}; 982("undefined"==typeof eac||null===eac)&&$("body").empty(); 983// Overflow Product 984function ttOverflowProduct(){ 985 blocks.ttProductDesign02.hover(function() { 986 if($('.tt-product-listing').length && $('.tt-product-listing').hasClass("tt-col-one")) return false; 987 988 if (window.innerWidth < 1024) return; 989 var objImgHeight = $(this).find('.tt-image-box').height(), 990 objScroll = $(this).find('.tt-description'), 991 objScrollHeight = objScroll.height() + 25; 992 993 if (objImgHeight > objScrollHeight) return; 994 $(this).addClass('tt-small'); 995 objScroll.height(objImgHeight).perfectScrollbar(); 996 997 }, function() { 998 if (window.innerWidth < 1024) return; 999 $(this).removeClass('tt-small').find('.tt-description').removeAttr('style').perfectScrollbar('destroy'); 1000 }); 1001}; 1002function ttReinitflowProduct(){ 1003 if (window.innerWidth < 1024 || $ttPageContent.find('.tt-product-design02').length == 0) return; 1004 $ttPageContent.find('.tt-product-design02').each(function() { 1005 $(this).perfectScrollbar('destroy'); 1006 var objImgHeight = $(this).find('.tt-image-box').height(), 1007 objScroll = $(this).find('.tt-description'), 1008 objScrollHeight = objScroll.height() + 25; 1009 1010 if (objImgHeight > objScrollHeight) return; 1011 $(this).addClass('tt-small'); 1012 objScroll.height(objImgHeight).perfectScrollbar(); 1013 }); 1014} 1015 1016// portfolio mobile click 1017function ttPortfolioContentMobile(){ 1018 blocks.ttPortfolioContent.on('click', 'figure img', function() { 1019 $(this).closest(".tt-portfolio-content").find('figure').removeClass('gallery-click'); 1020 $(this).closest("figure").addClass('gallery-click'); 1021 }); 1022}; 1023 1024//toggle col (listing-left-column.html) 1025function ttToggleCol() { 1026 var $btnClose = $ttLeftColumnAside.find('.tt-btn-col-close a'); 1027 1028 $('.tt-btn-toggle').on('click', function (e) { 1029 e.preventDefault(); 1030 var ttScrollValue = $body.scrollTop() || $html.scrollTop(); 1031 $ttLeftColumnAside.toggleClass('column-open'); 1032 !$ttLeftColumnAside.find('.ttpricefilter-js').length && $ttLeftColumnAside.perfectScrollbar(); 1033 $body.css("top", - ttScrollValue).addClass("no-scroll").append('<div class="modal-filter"></div>'); 1034 var modalFilter = $('.modal-filter').fadeTo('fast',1); 1035 if (modalFilter.length) { 1036 modalFilter.click(function() { 1037 $btnClose.trigger('click'); 1038 }) 1039 } 1040 return false;
1041 }); 1042 blocks.ttBtnColumnClose.on('click', function(e) { 1043 e.preventDefault(); 1044 $ttLeftColumnAside.removeClass('column-open'); 1045 !$ttLeftColumnAside.find('.ttpricefilter-js').length && $ttLeftColumnAside.perfectScrollbar('destroy'); 1046 var top = parseInt($body.css("top").replace("px", ""), 10) * -1; 1047 $body.removeAttr("style").removeClass("no-scroll").scrollTop(top); 1048 $html.removeAttr("style").scrollTop(top); 1049 $(".modal-filter").unbind().remove(); 1050 }); 1051}; 1052function getInternetExplorerVersion() { 1053 var rv = -1; 1054 if (navigator.appName === 'Microsoft Internet Explorer') { 1055 var ua = navigator.userAgent; 1056 var re = new RegExp("MSIE ([0-9]{1,}[\.0-9]{0,})"); 1057 if (re.exec(ua) != null) 1058 rv = parseFloat(RegExp.$1); 1059 } else if (navigator.appName === 'Netscape') { 1060 var ua = navigator.userAgent; 1061 var re = new RegExp("Trident/.*rv:([0-9]{1,}[\.0-9]{0,})"); 1062 if (re.exec(ua) != null) 1063 rv = parseFloat(RegExp.$1); 1064 } 1065 return rv; 1066}; 1067// identify touch device 1068function is_touch_device() { 1069 return !!('ontouchstart' in window) || !!('onmsgesturechange' in window); 1070}; 1071if (is_touch_device()) { 1072 $body.addClass('touch-device'); 1073 $html.addClass('touch-device'); 1074}; 1075if (/Edge/.test(navigator.userAgent)) { 1076 $html.addClass('edge'); 1077}; 1078//video 1079function ttVideoBlock() { 1080 $('.tt-video-block').on('click', function (e) { 1081 e.preventDefault(); 1082 var myVideo = $(this).find('.movie')[0]; 1083 if (myVideo.paused) { 1084 myVideo.play(); 1085 $(this).addClass('play'); 1086 } else { 1087 myVideo.pause(); 1088 $(this).removeClass('play'); 1089 } 1090 }); 1091}; 1092// Blog Masonr 1093function gridGalleryMasonr() { 1094 // init Isotope 1095 var $grid = blocks.ttBlogMasonry.find('.tt-blog-init').isotope({ 1096 itemSelector: '.element-item', 1097 layoutMode: 'masonry', 1098 }); 1099 // layout Isotope after each image loads 1100 $grid.imagesLoaded().progress( function() { 1101 $grid.isotope('layout').addClass('tt-show'); 1102 }); 1103 // filter functions 1104 var ttFilterNav = blocks.ttBlogMasonry.find('.tt-filter-nav'); 1105 if (ttFilterNav.length) { 1106 var filterFns = { 1107 ium: function() { 1108 var name = $(this).find('.name').text(); 1109 return name.match(/ium$/); 1110 } 1111 }; 1112 // bind filter button click 1113 ttFilterNav.on('click', '.button', function() { 1114 var filterValue = $(this).attr('data-filter'); 1115 filterValue = filterFns[filterValue] || filterValue; 1116 $grid.isotope({ 1117 filter: filterValue 1118 }); 1119 $(this).addClass('active').siblings().removeClass('active'); 1120 }); 1121 }; 1122}; 1123// Product Masonr (listing-metro.html) 1124function gridProductMasonr() { 1125 // init Isotope 1126 var $grid = blocks.ttProductMasonry.find('.tt-product-init').isotope({ 1127 itemSelector: '.element-item', 1128 layoutMode: 'masonry', 1129 }); 1130 // layout Isotope after each image loads 1131 $grid.imagesLoaded().progress( function() { 1132 $grid.isotope('layout'); 1133 }); 1134 // filter functions 1135 var ttFilterNav = blocks.ttProductMasonry.find('.tt-filter-nav'); 1136 if (ttFilterNav.length) { 1137 var filterFns = { 1138 ium: function() { 1139 var name = $(this).find('.name').text(); 1140 return name.match(/ium$/); 1141 } 1142 }; 1143 // bind filter button click 1144 ttFilterNav.on('click', '.button', function() { 1145 var filterValue = $(this).attr('data-filter'); 1146 filterValue = filterFns[filterValue] || filterValue; 1147 $grid.isotope({ 1148 filter: filterValue 1149 }); 1150 $(this).addClass('active').siblings().removeClass('active'); 1151 }); 1152 }; 1153}; 1154// collapseBlock(pages listing) *listing-left-column.html 1155function ttCollapse() { 1156 var item = blocks.ttCollapse, 1157 itemTitle = item.find('.tt-collapse-title'), 1158 itemContent = item.find('.tt-collapse-content'); 1159 1160 item.each(function() { 1161 if ($(this).hasClass('open')) { 1162 $(this).find(itemContent).slideDown(); 1163 } else { 1164 $(this).find(itemContent).slideUp(); 1165 } 1166 }); 1167 itemTitle.on('click', function(e) { 1168 e.preventDefault(); 1169 var speed = 300; 1170 var thisParent = $(this).parent(), 1171 nextLevel = $(this).next('.tt-collapse-content'); 1172 if (thisParent.hasClass('open')) { 1173 thisParent.removeClass('open'); 1174 nextLevel.slideUp(speed); 1175 } else { 1176 thisParent.addClass('open'); 1177 nextLevel.slideDown(speed); 1178 } 1179 }) 1180}; 1181// ttFiltersOptions 1182(function($) { 1183 $.fn.removeClassFirstPart = function(mask) { 1184 return this.removeClass(function(index, cls) { 1185 var re = mask.replace(/\*/g, '\\S+'); 1186 return (cls.match(new RegExp('\\b' + re + '', 'g')) || []).join(' '); 1187 }); 1188 }; 1189})(jQuery); 1190 1191function ttFilterLayout(ttwindowWidth){ 1192 if($('.tt-product-listing').hasClass("only-row")) return false;
1193 // detach filter aside left 1194 if($ttFilterOptions.hasClass('desctop-no-sidebar') && !$ttFilterOptions.hasClass('filters-detach-mobile')){ 1195 ttwindowWidth <= 1024 ? insertMobileCol() : insertFilter(); 1196 }; 1197 if($ttFilterOptions.hasClass('filters-detach-mobile')){ 1198 ttwindowWidth <= 1024 ? insertMobileCol() : insertFilter(); 1199 }; 1200 if(!$ttFilterOptions.hasClass('desctop-no-sidebar')){ 1201 ttwindowWidth <= 1024 ? insertMobileCol() : insertFilter(); 1202 }; 1203 1204 function insertMobileCol(){ 1205 if(!blocks.ttFilterDetachOption.find('.filters-row-select').length) return false; 1206 var objFilterOptions = blocks.ttFilterSort.find('select').detach(); 1207 blocks.ttFilterDetachOption.find('.filters-row-select').append(objFilterOptions); 1208 }; 1209 function insertFilter(){ 1210 if(!blocks.ttFilterDetachOption.find('.filters-row-select').length) return false; 1211 var objColFilterOptions = blocks.ttFilterDetachOption.find('.filters-row-select select').detach(); 1212 blocks.ttFilterSort.append(objColFilterOptions); 1213 }; 1214 1215 //active filter detection 1216 blocks.ttProductListing.removeClassFirstPart("tt-col-*"); 1217 1218 var ttQuantity = $ttFilterOptions.find('.tt-quantity'), 1219 ttProductItem = blocks.ttProductListing.find('.tt-col-item:first'), 1220 ttProductItemValue = (function(){ 1221 if(ttQuantity.length && ttProductItem.length){ 1222 var ttValue = parseInt(ttProductItem.css("flex").replace("0 0", "").replace("%", ""), 10) || parseInt(ttProductItem.css("max-width"), 10); 1223 return ttValue; 1224 }; 1225 }()); 1226 1227 if(ttProductItemValue == 16){ 1228 ttСhangeclass(ttQuantity, '.tt-col-six'); 1229 } else if(ttProductItemValue == 25){ 1230 ttСhangeclass(ttQuantity, '.tt-col-four'); 1231 } else if(ttProductItemValue == 33){ 1232 ttСhangeclass(ttQuantity, '.tt-col-three'); 1233 } else if(ttProductItemValue == 50){ 1234 ttСhangeclass(ttQuantity, '.tt-col-two'); 1235 } else if(ttProductItemValue == 100){ 1236 ttСhangeclass(ttQuantity, '.tt-col-one'); 1237 }; 1238 1239 function ttСhangeclass(ttObj, ttObjvalue){ 1240 ttwindowWidth <= 1024 ? ttShowIconMobile(ttObj, ttObjvalue) : ttShowIconDesctop(ttObj, ttObjvalue); 1241 if(ttObj.find(".active").length == 0 || !ttObj.find(".active").hasClass('tt-show-siblings')) ttObj.find(ttObjvalue).addClass('active').siblings().removeClass('active'); 1242 }; 1243 1244 function ttShowIconDesctop(ttObj, ttObjvalue){ 1245 1246 ttObj.find('.tt-show').removeClass('tt-show'); 1247 ttObj.find('.tt-show-siblings').removeClass('tt-show-siblings'); 1248 1249 var $this = ttObj.find(ttObjvalue); 1250 $this.addClass('tt-show'); 1251 1252 $this.next().addClass('tt-show-siblings'); 1253 $this.prev().addClass('tt-show-siblings'); 1254 var quantitySiblings = $('.tt-quantity .tt-show-siblings').length; 1255 if(quantitySiblings === 1){ 1256 ttObj.find('.tt-show-siblings').prev().addClass('tt-show-siblings'); 1257 }; 1258 1259 if(!Boolean($('.tt-product-listing').data("onerow"))) return false; 1260 $(".tt-col-one").addClass('tt-show-siblings'); 1261 var _ca = ttObj.find(".active").data("value"); 1262 $('.tt-product-listing').addClass(_ca); 1263 }; 1264 function ttShowIconMobile(ttObj, ttObjvalue){ 1265 ttObj.find('.tt-show').removeClass('tt-show'); 1266 ttObj.find('.tt-show-siblings').removeClass('tt-show-siblings'); 1267 1268 var $this = ttObj.find(ttObjvalue); 1269 $this.addClass('tt-show'); 1270 $this.prev().addClass('tt-show-siblings'); 1271 1272 if($('.tt-product-listing').data("onerow") == "false") return false; 1273 $(".tt-col-one").addClass('tt-show-siblings'); 1274 var _ca = ttObj.find(".active").data("value"); 1275 $('.tt-product-listing').addClass(_ca); 1276 }; 1277 1278 //click buttons filter 1279 $('body').on('click', '.tt-filters-options a', function(e) { 1280 e.preventDefault(); 1281 ttQuantity.find('a').removeClass('active'); 1282 var ttActiveValue = $(this).addClass('active').attr('data-value'); 1283 $ttPageContent.find('.tt-product-listing').removeClassFirstPart("tt-col-*").addClass(ttActiveValue); 1284 ttProductSmall(); 1285 initImagesSize(); 1286 }); 1287}; 1288 1289 1290// Portfolio 1291function gridPortfolioMasonr() { 1292 // init Isotope 1293 var $grid = blocks.ttPortfolioMasonry.find('.tt-portfolio-content').isotope({ 1294 itemSelector: '.element-item', 1295 layoutMode: 'masonry', 1296 }); 1297 // layout Isotope after each image loads 1298 $grid.imagesLoaded().progress( function() { 1299 $grid.isotope('layout').addClass('tt-show'); 1300 }); 1301 // filter functions 1302 var ttFilterNav = blocks.ttPortfolioMasonry.find('.tt-filter-nav'); 1303 if (ttFilterNav.length) {
1304 var filterFns = { 1305 ium: function() { 1306 var name = $(this).find('.name').text(); 1307 return name.match(/ium$/); 1308 } 1309 }; 1310 // bind filter button click 1311 ttFilterNav.on('click', '.button', function() { 1312 var filterValue = $(this).attr('data-filter'); 1313 filterValue = filterFns[filterValue] || filterValue; 1314 $grid.isotope({ 1315 filter: filterValue 1316 }); 1317 $(this).addClass('active').siblings().removeClass('active'); 1318 }); 1319 }; 1320}; 1321function initPortfolioPopup() { 1322 var objZoom = $ttPageContent.find('.tt-portfolio-masonry .tt-btn-zomm'); 1323 objZoom.magnificPopup({ 1324 type: 'image', 1325 gallery: { 1326 enabled: true 1327 } 1328 }); 1329}; 1330//input-counter 1331function ttInputCounter() { 1332 blocks.ttInputCounter.find('.minus-btn, .plus-btn').click(function( e ) { 1333 var $input = $(this).parent().find('input'); 1334 var count = parseInt($input.val(), 10) + parseInt(e.currentTarget.className === 'plus-btn' ? 1 : -1, 10); 1335 $input.val(count).change(); 1336 }); 1337 blocks.ttInputCounter.find("input").change(function() { 1338 var _ = $(this); 1339 var min = 1; 1340 var val = parseInt(_.val(), 10); 1341 var max = parseInt(_.attr('size'), 10); 1342 val = Math.min(val, max); 1343 val = Math.max(val, min); 1344 _.val(val); 1345 }) 1346 .on("keypress", function( e ) { 1347 if (e.keyCode === 13) { 1348 e.preventDefault(); 1349 } 1350 }); 1351}; 1352//popup on pages product single 1353function ttVideoPopup() { 1354 blocks.modalVideoProduct.on('show.bs.modal', function(e) { 1355 var relatedTarget = $(e.relatedTarget), 1356 attr = relatedTarget.attr('data-value'), 1357 attrPoster = relatedTarget.attr('data-poster'), 1358 attrType = relatedTarget.attr('data-type'); 1359 1360 if(attrType === "youtube" || attrType === "vimeo" || attrType === undefined){ 1361 $('<iframe src="'+attr+'" allowfullscreen></iframe>').appendTo($(this).find('.modal-video-content')); 1362 }; 1363 1364 if(attrType === "video"){ 1365 $('<div class="tt-video-block"><a href="#" class="link-video"></a><video class="movie" src="'+attr+'" poster="'+attrPoster+'" allowfullscreen></video></div>').appendTo($(this).find('.modal-video-content')); 1366 1367 }; 1368 ttVideoBlock(); 1369 }).on('hidden.bs.modal', function () { 1370 $(this).find('.modal-video-content').empty(); 1371 }); 1372}; 1373//product pages 1374var elevateZoomWidget = { 1375 scroll_zoom: true, 1376 class_name: '.zoom-product', 1377 scrollslider_parent: $('.slider-scroll-product'),
1378 checkNoZoom: function(){ 1379 return $(this.class_name).parent().parent().hasClass('no-zoom'); 1380 }, 1381 get_thumb_parent: function(){ 1382 return $('#smallGallery'); 1383 }, 1384 init: function(type){ 1385 var _ = this; 1386 var currentW = window.innerWidth || $(window).width(); 1387 var zoom_image = $(_.class_name); 1388 var _thumbs = _.get_thumb_parent(); 1389 _.initBigGalleryButtons(); 1390 _.scrollSlider(); 1391 1392 if(zoom_image.length == 0) return false; 1393 if(!_.checkNoZoom()){ 1394 var attr_scroll = zoom_image.parent().parent().attr('data-scrollzoom'); 1395 attr_scroll = attr_scroll ? attr_scroll : _.scroll_zoom; 1396 _.scroll_zoom = attr_scroll == 'false' ? false : true; 1397 currentW > 575 && _.configureZoomImage(); 1398 _.resize(); 1399 } 1400 1401 if(_thumbs.length == 0) return false; 1402 var thumb_type = _thumbs.parent().attr('class').indexOf('-vertical') > -1 ? 'vertical' : 'horizontal'; 1403 _[thumb_type](_thumbs); 1404 _.setBigImage(_thumbs); 1405 }, 1406 configureZoomImage: function(){ 1407 var _ = this; 1408 $('.zoomContainer').remove(); 1409 var zoom_image = $(this.class_name); 1410 zoom_image.each(function(){ 1411 var _this = $(this); 1412 var clone = _this.removeData('elevateZoom').clone(); 1413 _this.after(clone).remove(); 1414 }); 1415 setTimeout(function(){ 1416 $(_.class_name).elevateZoom({ 1417 gallery: _.get_thumb_parent().attr('id'), 1418 zoomType: "inner", 1419 scrollZoom: Boolean(_.scroll_zoom), 1420 cursor: "crosshair", 1421 zoomWindowFadeIn: 300, 1422 zoomWindowFadeOut: 300 1423 }); 1424 }, 100); 1425 }, 1426 resize: function(){ 1427 var _ = this; 1428 $(window).resize(function(){ 1429 var currentW = window.innerWidth || $(window).width(); 1430 if(currentW <= 575) return false; 1431 _.configureZoomImage(); 1432 }); 1433 }, 1434 horizontal: function(_parent){ 1435 _parent.hasClass('slick-slider') && _parent.slick('unslick'); 1436 _parent.on('init', function(event, slick){ 1437 var event = new CustomEvent('desktop-slider-initialized', { 'detail': $(this) }); 1438 window.dispatchEvent(event); 1439 }); 1440 _parent.slick({ 1441 lazyLoad: 'progressive', 1442 infinite: false, 1443 dots: false, 1444 arrows: true, 1445 slidesToShow: 6, 1446 slidesToScroll: 1, 1447 responsive: [{ 1448 breakpoint: 1200, 1449 settings: { 1450 slidesToShow: 4, 1451 slidesToScroll: 1 1452 } 1453 }, 1454 { 1455 breakpoint: 992, 1456 settings: { 1457 slidesToShow: 4, 1458 slidesToScroll: 1 1459 } 1460 }] 1461 }); 1462 }, 1463 vertical: function(_parent){ 1464 _parent.hasClass('slick-slider') && _parent.slick('unslick'); 1465 _parent.on('init', function(event, slick){ 1466 var event = new CustomEvent('desktop-slider-initialized', { 'detail': $(this) }); 1467 window.dispatchEvent(event); 1468 }); 1469 _parent.slick({ 1470 lazyLoad: 'progressive', 1471 vertical: true, 1472 infinite: false, 1473 slidesToShow: 5, 1474 slidesToScroll: 1, 1475 verticalSwiping: true, 1476 arrows: true, 1477 dots: false, 1478 centerPadding: "0px", 1479 customPaging: "0px", 1480 responsive: [{ 1481 breakpoint: 1200, 1482 settings: { 1483 slidesToShow: 5, 1484 slidesToScroll: 1 1485 } 1486 }, 1487 { 1488 breakpoint: 992, 1489 settings: { 1490 slidesToShow: 5, 1491 slidesToScroll: 1 1492 } 1493 }, 1494 { 1495 breakpoint: 768, 1496 settings: { 1497 slidesToShow: 5, 1498 slidesToScroll: 1 1499 } 1500 }] 1501 }); 1502 }, 1503 initBigGalleryButtons: function(){ 1504 var bigGallery = $('.bigGallery'); 1505 if(bigGallery.length == 0) return false; 1506 $( 'body' ).on( 'mouseenter', '.zoomContainer', 1507 function(){ bigGallery.find('button').addClass('show'); } 1508 ).on( 'mouseleave', '.zoomContainer', 1509 function(){ bigGallery.find('button').removeClass('show'); } 1510 ); 1511 }, 1512 scrollSlider: function(){ 1513 var _scrollslider_parent = this.scrollslider_parent; 1514 if(_scrollslider_parent.length == 0) return false;
1515 _scrollslider_parent.on('init', function(event, slick) { 1516 _scrollslider_parent.css({ 'opacity': 1 }); 1517 }); 1518 _scrollslider_parent.css({ 'opacity': 0 }).slick({ 1519 infinite: false, 1520 vertical: true, 1521 verticalScrolling: true, 1522 dots: true, 1523 arrows: false, 1524 slidesToShow: 1, 1525 slidesToScroll: 1, 1526 responsive: [{ 1527 breakpoint: 1200, 1528 settings: { 1529 slidesToShow: 1, 1530 slidesToScroll: 1 1531 } 1532 }, 1533 { 1534 breakpoint: 992, 1535 settings: { 1536 slidesToShow: 1, 1537 slidesToScroll: 1 1538 } 1539 }, 1540 { 1541 breakpoint: 768, 1542 settings: { 1543 slidesToShow: 1, 1544 slidesToScroll: 1 1545 } 1546 }] 1547 }).mousewheel(function(e) { 1548 e.preventDefault(); 1549 e.deltaY < 0 ? $(this).slick('slickNext') : $(this).slick('slickPrev'); 1550 }); 1551 }, 1552 setBigImage: function(_parent){ 1553 var _ = this; 1554 _parent.find('a').click(function(e){ 1555 _.checkNoZoom() && e.preventDefault(); 1556 var zoom_image = $(_.class_name); 1557 var getParam = _.checkNoZoom() ? 'data-image' : 'data-zoom-image'; 1558 var setParam = _.checkNoZoom() ? 'src' : 'data-zoom-image'; 1559 var big_image = $(this).attr(getParam); 1560 zoom_image.attr(setParam, big_image); 1561 1562 if(!_.checkNoZoom()) return false; 1563 _parent.find('.zoomGalleryActive').removeClass('zoomGalleryActive'); 1564 $(this).addClass('zoomGalleryActive'); 1565 }); 1566 } 1567}; 1568 1569// product single tt-btn-zomm(*magnific popup) 1570function ttProductSingleBtnZomm() { 1571 $body.on('click', '.tt-product-single-img .tt-btn-zomm', function (e) { 1572 var objSmallGallery = $('#smallGallery'); 1573 objSmallGallery.find('[data-zoom-image]').each(function(){ 1574 var dataZoomImg = $(this).attr('data-zoom-image'); 1575 if(dataZoomImg.length){ 1576 $(this).closest('li').append("<a class='link-magnific-popup' href='#'></a>").find('.link-magnific-popup').attr('href', dataZoomImg); 1577 if($(this).hasClass('zoomGalleryActive')){ 1578 $(this).closest('li').find('.link-magnific-popup').addClass('zoomGalleryActive'); 1579 }; 1580 }; 1581 }); 1582 objSmallGallery.addClass('tt-magnific-popup').find('.link-magnific-popup').magnificPopup({ 1583 type: 'image', 1584 gallery: { 1585 enabled: true, 1586 tCounter: '<span class="mfp-counter"></span>' 1587 }, 1588 callbacks: { 1589 close: function() { 1590 setTimeout(function() { 1591 objSmallGallery.removeClass('tt-magnific-popup').find('.link-magnific-popup').remove(); 1592 }, 200); 1593 1594 } 1595 } 1596 }); 1597 objSmallGallery.find('.link-magnific-popup.zoomGalleryActive').trigger('click'); 1598 }); 1599}; 1600 1601//sticky(product-05.html) 1602function ttAirSticky(ttwindowWidth){ 1603 var airStickyObj = blocks.ttAirSticky, 1604 tabObj = blocks.ttCollapseBlock.find('.tt-collapse-title'); 1605 1606 if(ttwindowWidth >= 1024){ 1607 airStickyObj.airStickyBlock({ 1608 debug: false, 1609 stopBlock: '.airSticky_stop-block', 1610 offsetTop: 70, 1611 }); 1612 } else if(airStickyObj.hasClass('airSticky_absolute')) { 1613 airStickyObj.removeClass('airSticky_absolute'); 1614 }; 1615 $document.on('resize scroll', tabObj, function () { 1616 airStickyObj.trigger('render.airStickyBlock'); 1617 }); 1618 tabObj.on('click', function() { 1619 setTimeout(function(){ 1620 airStickyObj.trigger('render.airStickyBlock'); 1621 }, 170); 1622 }); 1623}; 1624// img for ratio > 1 1625if (window.devicePixelRatio > 1) { 1626 var ttImgToReplace = $('.tt-retina'); 1627 for (var i = 0, l = ttImgToReplace.length; i < l; i++) { 1628 var src = ttImgToReplace[i].src; 1629 src = src.replace(/\.(png|jpg|gif)+$/i, '@2x.$1'); 1630 ttImgToReplace[i].src = src; 1631 }; 1632}; 1633 1634 1635 1636/** 1637 * Stuck init. Properties: on/off 1638 * @value = 'off', default empty 1639 */ 1640function initStuck(value) { 1641 if($stucknav.hasClass('disabled')) return; 1642 1643 var value = value || false, 1644 ie = (getInternetExplorerVersion() !== -1) ? true : false; 1645 1646 if (value === 'off') return false;
1647 var n = 0; 1648 $window.scroll(function() { 1649 var HeaderTop = $('header').innerHeight(); 1650 var mh = $('header').innerHeight(); 1651 var $hil = $('header').find('.tt-mobile-header-inline-stuck'); 1652 if($hil.length && window.innerWidth < 1025){ 1653 HeaderTop = $('.innerheadercontainer').length ? $('.innerheadercontainer').innerHeight() : $('header').innerHeight(); 1654 } 1655 if ($window.scrollTop() > HeaderTop) { 1656 if ($stucknav.hasClass('stuck')) return false; 1657 1658 if($hil.length && window.innerWidth < 1025){ 1659 $('<div class="innerheadercontainer" style="height:'+mh+'px;"></div>').insertBefore('header'); 1660 $stucknav.addClass('stuck').show(); 1661 $hil.addClass('stuck').stop().hide().fadeIn().closest('header').addClass('headerisstuck'); 1662 } 1663 else{ 1664 $hil.length && $hil.addClass('stuck').closest('header').addClass('headerisstuck'); 1665 $stucknav.hide(); 1666 $stucknav.addClass('stuck'); 1667 $('body').trigger('showStuck'); 1668 window.innerWidth < 1025 ? $ttStuckParentMenu.append($ttMobileParentMenuChildren.detach()) : $ttStuckParentMenu.append($ttDesctopMenu.first().detach()); 1669 $ttStuckParentCart.append($ttcartObj.detach()); 1670 $ttStuckParentMulti.append($ttMultiObj.detach()); 1671 $ttStuckParentAccount.append($ttAccountObj.detach()); 1672 $ttStuckParentSearch.append($ttSearchObj.detach()); 1673 1674 if ($stucknav.find('.tt-stuck-cart-parent > .tt-cart > .dropdown').hasClass('open') || ie) 1675 $stucknav.stop().show(); 1676 else 1677 $stucknav.stop().fadeIn(300); 1678 1679 } 1680 } else { 1681 if (!$stucknav.hasClass('stuck')) return false; 1682 1683 if($hil.length && window.innerWidth < 1025){ 1684 $('.innerheadercontainer').length && $('.innerheadercontainer').remove(); 1685 $stucknav.hide().removeClass('stuck'); 1686 $hil.removeClass('stuck').removeAttr('style').closest('header').removeClass('headerisstuck'); 1687 $ttDesctopParentMenu.append($ttDesctopMenu.first().detach()); 1688 } 1689 else{ 1690 $('.innerheadercontainer').length && $('.innerheadercontainer').remove(); 1691 $hil.length && $hil.removeClass('stuck').closest('header').removeClass('headerisstuck'); 1692 $stucknav.hide(); 1693 $stucknav.removeClass('stuck'); 1694 $('body').trigger('hideStuck'); 1695 if (window.innerWidth < 1025) { 1696 $ttMobileParentMenu.append($ttMobileParentMenuChildren.detach()); 1697 $ttMobileParentCart.append($ttcartObj.detach()); 1698 $ttMobileParentMulti.append($ttMultiObj.detach()); 1699 $ttMobileParentAccount.append($ttAccountObj.detach()); 1700 $ttMobileParentSearch.append($ttSearchObj.detach()); 1701 return false; 1702 } 1703 $ttDesctopParentMenu.append($ttDesctopMenu.first().detach()); 1704 $ttDesctopParentCart.append($ttcartObj.detach()); 1705 $ttDesctopParentMulti.append($ttMultiObj.detach()); 1706 $ttDesctopParentAccount.append($ttAccountObj.detach()); 1707 $ttDesctopParentSearch.append($ttSearchObj.detach()); 1708 } 1709 } 1710 }); 1711 $window.resize(function() { 1712 if(window.innerWidth < 1025 && $('header').find('.tt-mobile-header-inline-stuck').length) { 1713 var chs = $('header').find('.tt-mobile-parent-menu-icons'); 1714 if(!chs.length) return false; 1715 if(!chs.children().length) return false; 1716 if(chs.children().first().children().length) return false; 1717 $ttMobileParentCart.append($ttcartObj.detach()); 1718 $ttMobileParentSearch.append($ttSearchObj.detach()); 1719 return false; 1720 } 1721 1722 if (!$stucknav.hasClass('stuck')) return false; 1723 1724 if (window.innerWidth < 1025) { 1725 $ttDesctopParentMenu.append($ttDesctopMenu.first().detach()); 1726 $ttStuckParentMenu.append($ttMobileParentMenuChildren.detach()); 1727 } else { 1728 if($('header').find('.tt-mobile-header-inline-stuck').length){ 1729 var chs = $('header').find('.tt-mobile-parent-menu-icons'); 1730 if(!chs.length) return false; 1731 if(!chs.children().length) return false; 1732 if(!chs.children().first().children().length) return false; 1733 $ttStuckParentMenu.append($ttDesctopMenu.first().detach()); 1734 $ttStuckParentCart.append($ttcartObj.detach()); 1735 $ttStuckParentMulti.append($ttMultiObj.detach()); 1736 $ttStuckParentAccount.append($ttAccountObj.detach()); 1737 $ttStuckParentSearch.append($ttSearchObj.detach()); 1738 $('.tt-mobile-header').removeAttr('style'); 1739 $('.innerheadercontainer').length && $('.innerheadercontainer').remove(); 1740 } 1741 else{ 1742 $ttMobileParentMenu.append($ttMobileParentMenuChildren.detach()); 1743 $ttStuckParentMenu.append($ttDesctopMenu.first().detach()); 1744 } 1745 } 1746 }); 1747}; 1748//header search 1749function mobileParentSearch() { 1750 if (window.innerWidth < 1025) { 1751 if ($ttMobileParentSearch.children().length) return false;
1752 if ($('.stuck').length) return false; 1753 $ttMobileParentSearch.append($ttSearchObj.detach()); 1754 } else { 1755 if ($ttDesctopParentSearch.children().length) return false; 1756 if ($('.stuck').length) return false; 1757 $ttDesctopParentSearch.append($ttSearchObj.detach()); 1758 }; 1759}; 1760//header cart 1761function mobileParentCart() { 1762 if (window.innerWidth < 1025) { 1763 if ($ttMobileParentCart.children().length) return false; 1764 if ($('.stuck').length) return false; 1765 $ttMobileParentCart.append($ttcartObj.detach()); 1766 } else { 1767 if ($ttDesctopParentCart.children().length) return false; 1768 if ($('.stuck').length) return false; 1769 $ttDesctopParentCart.append($ttcartObj.detach()); 1770 }; 1771}; 1772//header account 1773function mobileParentAccount() { 1774 if (window.innerWidth < 1025) { 1775 if ($ttMobileParentAccount.children().length) return false; 1776 if ($('.stuck').length) return false; 1777 if($('header').find('.tt-mobile-header-inline').length) return false; 1778 $ttMobileParentAccount.append($ttAccountObj.detach()); 1779 } else { 1780 if ($ttDesctopParentAccount.children().length) return false; 1781 if ($('.stuck').length) return false; 1782 $ttDesctopParentAccount.append($ttAccountObj.detach()); 1783 }; 1784}; 1785//header langue and currency(*all in one module) 1786function mobileParentMulti() { 1787 if (window.innerWidth < 1025) { 1788 if ($ttMobileParentMulti.children().length) return false; 1789 if ($('.stuck').length) return false; 1790 if($('header').find('.tt-mobile-header-inline').length) return false; 1791 $ttMobileParentMulti.append($ttMultiObj.detach()); 1792 } else { 1793 if ($ttDesctopParentMulti.children().length) return false; 1794 if ($('.stuck').length) return false; 1795 $ttDesctopParentMulti.append($ttMultiObj.detach()); 1796 }; 1797}; 1798 1799/* 1800 header menu 1801 */ 1802// header menu(hover) 1803(function toggle_header_menu() { 1804 var delay = header_menu_timeout, 1805 hoverTimer = header_menu_delay, 1806 timeout1 = false; 1807 1808 var set_dropdown_maxH = function() { 1809 var wind_H = window.innerHeight, 1810 $ttDesctopMenu = $(this).find('.dropdown-menu'), 1811 menu_top = $ttDesctopMenu.get(0).getBoundingClientRect().top, 1812 menu_max_H = wind_H - menu_top, 1813 $ttDesctopMenu_H = $ttDesctopMenu.innerHeight(), 1814 $btn_top = blocks.ttBackToTop; 1815 1816 if ($ttDesctopMenu_H > menu_max_H) { 1817 var $body = $('body'), 1818 $stuck = $('.tt-stuck-nav'); 1819 $ttDesctopMenu.css({ 1820 maxHeight: menu_max_H - 20, 1821 overflow: 'auto' 1822 }); 1823 1824 var scrollWidth = function() { 1825 var $div = $('<div>').css({ 1826 overflowY: 'scroll', 1827 width: '50px', 1828 height: '50px', 1829 visibility: 'hidden' 1830 }); 1831 1832 $body.append($div); 1833 var scrollWidth = $div.get(0).offsetWidth - $div.get(0).clientWidth; 1834 $div.remove(); 1835 1836 return scrollWidth; 1837 }; 1838 1839 $body.css({ 1840 overflowY: 'hidden', 1841 paddingRight: scrollWidth() 1842 }); 1843 1844 $stuck.css({ 1845 paddingRight: scrollWidth() 1846 }); 1847 1848 $btn_top.css({ 1849 right: scrollWidth() 1850 }); 1851 1852 $('.tt-header-static').length && $('.tt-header-static').css({'padding-right': scrollWidth()}); 1853 } 1854 }; 1855 1856 if ($ttDesctopMenu.length > 0) { 1857 $('.tt-megamenu-submenu li').each(function(){ 1858 if($(this).find('img').length){ 1859 $(this).closest('ul').addClass('tt-sub-img'); 1860 } 1861 }); 1862 $ttDesctopMenu.find('.dropdown-menu').each(function(){ 1863 if($(this).length){ 1864 $(this).closest('.dropdown').addClass('tt-submenu'); 1865 } 1866 }); 1867 1868 $(document).on({ 1869 mouseenter: function() { 1870 var $this = $(this), 1871 that = this, 1872 windowW = window.innerWidth || $(window).width(); 1873 1874 if (windowW > 1025 && $body.hasClass('touch-device')) { 1875 $ttDesctopMenu.find('.dropdown.tt-submenu > a').one("click", false); 1876 }; 1877 1878 timeout1 = setTimeout(function () { 1879 1880 var $carousel = $this.find('.tt-menu-slider'), 1881 $ttDesctopMenu = $this.find('.dropdown-menu'); 1882 1883 1884 $this.addClass('active') 1885 .find(".dropdown-menu") 1886 .stop() 1887 .addClass('hover')
1888 .fadeIn(hoverTimer); 1889 1890 if($ttDesctopMenu.length & !$ttDesctopMenu.hasClass('one-col')) { 1891 set_dropdown_maxH.call(that); 1892 } 1893 1894 if($carousel.length) { 1895 if(!$carousel.hasClass('slick-initialized')) { 1896 $carousel.slick({ 1897 dots: false, 1898 arrows: true, 1899 infinite: true, 1900 speed: 300, 1901 slidesToShow: 3, 1902 slidesToScroll: 3, 1903 adaptiveHeight: true 1904 }); 1905 } 1906 }; 1907 $carousel.slick('setPosition'); 1908 1909 }, delay); 1910 1911 }, 1912 mouseleave: function(e) { 1913 var $this = $(this), 1914 $dropdown = $this.find(".dropdown-menu"); 1915 1916 if($(e.target).parents('.dropdown-menu').length && !$(e.target).parents('.tt-megamenu-submenu').length && !$(e.target).parents('.one-col').length) return; 1917 1918 if(timeout1 !== false) { 1919 clearTimeout(timeout1); 1920 timeout1 = false; 1921 } 1922 1923 if($dropdown.length) { 1924 $dropdown.stop().fadeOut({duration: 0, complete: function() { 1925 $this.removeClass('active') 1926 .find(".dropdown-menu") 1927 .removeClass('hover'); 1928 }}); 1929 } else { 1930 $this.removeClass('active') 1931 .find(".dropdown-menu") 1932 .removeClass('hover'); 1933 } 1934 1935 $dropdown.removeAttr('style'); 1936 $('.tt-header-static').length && $('.tt-header-static').removeAttr('style'); 1937 1938 if(!$('body').hasClass('notdelete')){ 1939 $body.removeAttr('style'); 1940 } 1941 1942 $('.tt-stuck-nav').css({ 1943 paddingRight: 'inherit' 1944 }); 1945 1946 blocks.ttBackToTop.css({ 1947 right: 0 1948 }); 1949 } 1950 }, '.tt-desctop-menu li'); 1951 1952 $('.multicolumn ul li').hover(function() { 1953 var $ul = $(this).find('ul:first'); 1954 1955 if ($ul.length) { 1956 var windW = window.innerWidth, 1957 windH = window.innerHeight, 1958 ulW = parseInt($ul.css('width'), 10), 1959 thisR = this.getBoundingClientRect().right, 1960 thisL = this.getBoundingClientRect().left; 1961 1962 if (windW - thisR < ulW) { 1963 $ul.removeClass('left').addClass('right'); 1964 } else if (thisL < ulW) { 1965 $ul.removeClass('right').addClass('left'); 1966 } else { 1967 $ul.removeClass('left right'); 1968 } 1969 $ul.stop(true, true).fadeIn(300); 1970 } 1971 }, function() { 1972 $(this).find('ul:first').stop(true, true).fadeOut(300).removeAttr('style'); 1973 }); 1974 1975 $ttDesctopMenu.find('.tt-megamenu-submenu li').hover(function() { 1976 var $ul = $(this).find('ul:first'); 1977 1978 if ($ul.length) { 1979 var $dropdownMenu = $(this).parents('.dropdown').find('.dropdown-menu'), 1980 dropdown_left = parseInt($(this).get(0).getBoundingClientRect().left, 10), 1981 dropdown_Right = $dropdownMenu.get(0).getBoundingClientRect().right, 1982 dropdown_Bottom = $dropdownMenu.get(0).getBoundingClientRect().bottom, 1983 ulW = parseInt($ul.css('width'), 10), 1984 thisR = this.getBoundingClientRect().right, 1985 thisL = this.getBoundingClientRect().left, 1986 compareValue = parseInt(ulW + dropdown_left + 170, 10), 1987 ttwindowWidth = window.innerWidth; 1988 1989 1990 if (ttwindowWidth <= compareValue) { 1991 $(this).find('ul:first').removeClass('left').addClass('right'); 1992 } else if (ttwindowWidth > compareValue) { 1993 $(this).find('ul:first').css({left: parseInt($(this).find('a').innerWidth(), 10)}).removeClass('right').addClass('left'); 1994 }; 1995 1996 $ul.stop(true, true).delay(150).fadeIn(300); 1997 1998 var ul_bottom = $ul.get(0).getBoundingClientRect().bottom; 1999 2000 if (dropdown_Bottom < ul_bottom) { 2001 var move_top = dropdown_Bottom - ul_bottom; 2002 $ul.css({ 2003 top: move_top 2004 }); 2005 } 2006 } 2007 }, function() { 2008 $(this).find('ul:first').stop(true, true).fadeOut(300).removeAttr('style'); 2009 }); 2010 2011 $('.megamenu div').hover(function() { 2012 $(this).children('.tt-title-submenu').addClass('active'); 2013 }, function() { 2014 $(this).children('.tt-title-submenu').removeClass('active'); 2015 }); 2016 2017 } 2018 2019 function onscroll_dropdown_hover() { 2020 var $dropdown_active = $('.dropdown.hover'); 2021 2022 if (!$dropdown_active.find('.dropdown-menu').not('.one-col').length) return; 2023 2024 if ($dropdown_active.length) 2025 set_dropdown_maxH.call($dropdown_active); 2026 }; 2027 $(window).on('scroll', function() { 2028 onscroll_dropdown_hover(); 2029 }); 2030})(); 2031 2032/*! 2033 * jQuery Cookie Plugin v1.4.1 2034 * https://github.com/carhartl/jquery-cookie 2035 * 2036 * Copyright 2006, 2014 Klaus Hartl 2037 * Released under the MIT license 2038 */ 2039(function (factory) { 2040 if (typeof define === 'function' && define.amd) { 2041 define(['jquery'], factory); 2042 } else if (typeof exports === 'object') { 2043 module.exports = factory(require('jquery')); 2044 } else { 2045 factory(jQuery); 2046 } 2047}(function ($) { 2048 2049 var pluses = /\+/g; 2050 2051 function encode(s) { 2052 return config.raw ? s : encodeURIComponent(s); 2053 } 2054 2055 function decode(s) { 2056 return config.raw ? s : decodeURIComponent(s); 2057 } 2058 2059 function stringifyCookieValue(value) { 2060 return encode(config.json ? JSON.stringify(value) : String(value)); 2061 } 2062 2063 function parseCookieValue(s) { 2064 if (s.indexOf('"') === 0) { 2065 s = s.slice(1, -1).replace(/\\"/g, '"').replace(/\\\\/g, '\\'); 2066 } 2067 2068 try { 2069 s = decodeURIComponent(s.replace(pluses, ' ')); 2070 return config.json ? JSON.parse(s) : s; 2071 } catch(e) {} 2072 } 2073 2074 function read(s, converter) { 2075 var value = config.raw ? s : parseCookieValue(s); 2076 return $.isFunction(converter) ? converter(value) : value; 2077 } 2078 2079 var config = $.cookie = function (key, value, options) { 2080 2081 if (arguments.length > 1 && !$.isFunction(value)) { 2082 options = $.extend({}, config.defaults, options); 2083 2084 if (typeof options.expires === 'number') { 2085 var days = options.expires, t = options.expires = new Date(); 2086 t.setMilliseconds(t.getMilliseconds() + days * 864e+5); 2087 } 2088 2089 return (document.cookie = [ 2090 encode(key), '=', stringifyCookieValue(value), 2091 options.expires ? '; expires=' + options.expires.toUTCString() : '', // use expires attribute, max-age is not supported by IE 2092 options.path ? '; path=' + options.path : '', 2093 options.domain ? '; domain=' + options.domain : '', 2094 options.secure ? '; secure' : '' 2095 ].join('')); 2096 } 2097 2098 var result = key ? undefined : {}, 2099 cookies = document.cookie ? document.cookie.split('; ') : [], 2100 i = 0, 2101 l = cookies.length; 2102 2103 for (; i < l; i++) { 2104 var parts = cookies[i].split('='), 2105 name = decode(parts.shift()), 2106 cookie = parts.join('='); 2107 2108 if (key === name) { 2109 result = read(cookie, value); 2110 break; 2111 } 2112 2113 if (!key && (cookie = read(cookie)) !== undefined) { 2114 result[name] = cookie; 2115 } 2116 } 2117 2118 return result; 2119 }; 2120 2121 config.defaults = {}; 2122 2123 $.removeCookie = function (key, options) { 2124 $.cookie(key, '', $.extend({}, options, { expires: -1 })); 2125 return !$.cookie(key); 2126 }; 2127 2128})); 2129 2130function subscribeErrorHandler(){ 2131 if($('.errors').length == 0) return false;
2132 $('[type="email"]').on('focus', function(){ 2133 $(this).unbind().closest('form').find('.errors').length && $(this).closest('form').find('.errors').remove(); 2134 }) 2135} 2136subscribeErrorHandler(); 2137 2138/* Sections */ 2139var hoverColors = { 2140 params: { 2141 baseColor: 'data-c', 2142 activeColor: 'data-ac', 2143 bgBaseColor: 'data-bgc', 2144 bgActiveColor: 'data-abgc', 2145 borderBaseColor: 'data-borc', 2146 borderActiveColor: 'data-aborc', 2147 }, 2148 init: function(){ 2149 var attrName = this.params; 2150 var he = $('[data-hovercolors]'); 2151 if(he.length == 0) return false; 2152 he.each(function(){ 2153 hoverColors.getCurrentColors($(this), attrName.baseColor, attrName.bgBaseColor, attrName.borderBaseColor); 2154 }); 2155 }, 2156 initEvents: function(){ 2157 var attrName = this.params; 2158 $('body').on({ 2159 mouseenter: function(){ 2160 hoverColors.getCurrentColors($(this), attrName.activeColor, attrName.bgActiveColor, attrName.borderActiveColor ); 2161 }, 2162 mouseleave: function(){ 2163 hoverColors.getCurrentColors($(this), attrName.baseColor, attrName.bgBaseColor, attrName.borderBaseColor ); 2164 }}, '[data-hovercolors]' 2165 ); 2166 }, 2167 getCurrentColors: function(_, attr1, attr2, attr3){ 2168 hoverColors.setCurrentColors(_, attr1, attr2, attr3); 2169 var attr = false;
2170 2171 var ac = _.find('['+ attr1 +']'); 2172 if(ac.length > 0) { 2173 ac.each(function(){ 2174 attr = $(this).attr("use-on-hover"); 2175 if (typeof attr !== typeof undefined && attr !== false && _ != $(this)) return true; 2176 var c = $(this).attr(attr1); 2177 $(this).css('color', c); 2178 }); 2179 } 2180 2181 ac = _.find('['+ attr2 +']'); 2182 if(ac.length > 0) { 2183 ac.each(function(){ 2184 attr = $(this).attr("use-on-hover"); 2185 if (typeof attr !== typeof undefined && attr !== false && _ != $(this)) return true; 2186 hoverColors.setCurrentBgColor($(this), attr2); 2187 }); 2188 } 2189 2190 ac = _.find('['+ attr3 +']'); 2191 if(ac.length > 0) { 2192 ac.each(function(){ 2193 attr = $(this).attr("use-on-hover"); 2194 if (typeof attr !== typeof undefined && attr !== false && _ != $(this)) return true; 2195 hoverColors.setCurrentBorderColor($(this), attr3); 2196 }); 2197 } 2198 }, 2199 setCurrentBgColor: function(_, attr){ 2200 var a = _.attr(attr); 2201 _.css({"background": a}); 2202 }, 2203 setCurrentBorderColor: function(_, attr){ 2204 var a = _.attr(attr); 2205 if (typeof a !== typeof undefined && a !== false) { 2206 _.css('border-color', a); 2207 } 2208 }, 2209 setCurrentColors: function(_, attr1, attr2, attr3){ 2210 var c = _.attr(attr1); 2211 _.css('color', c); 2212 2213 hoverColors.setCurrentBgColor(_, attr2); 2214 hoverColors.setCurrentBorderColor(_, attr3); 2215 2216 return false; 2217 } 2218} 2219hoverColors.initEvents(); 2220 2221// Countdown 2222function countDown(showZero) { 2223 if ($(".tt-countdown").length) { 2224 2225 var showZero = showZero || false; 2226 2227 $(".tt-countdown").each(function() { 2228 var $this = $(this), 2229 date = $this.data('date'), 2230 nextYear = false, 2231 tz = $('[name=timezone]'); 2232 2233 if(typeof moment === "function" && tz.length) nextYear = moment.tz($this.data('date'), tz.attr('content')); 2234 2235 if (date = date.split('-')) { 2236 date = date.join('/'); 2237 } else return; 2238 2239 var timezone = nextYear ? nextYear.toDate() : date; 2240 2241 $this.countdown(timezone, function(e) { 2242 var format = '<span class="countdown-row">'; 2243 2244 function addFormat(func, timeNum, showZero) { 2245 if(timeNum === 0 && !showZero) return; 2246 2247 func(format); 2248 }; 2249 2250 addFormat(function() { 2251 format += '<span class="countdown-section">' 2252 + '<span class="countdown-amount">' + e.offset.totalDays + '</span>' 2253 + '<span class="countdown-period">' + set_day + '</span>' 2254 + '</span>'; 2255 }, e.offset.totalDays, showZero); 2256 2257 addFormat(function() { 2258 format += '<span class="countdown-section">' 2259 + '<span class="countdown-amount">' + e.offset.hours + '</span>' 2260 + '<span class="countdown-period">' + set_hour + '</span>' 2261 + '</span>'; 2262 }, e.offset.hours, showZero); 2263 2264 addFormat(function() { 2265 format += '<span class="countdown-section">' 2266 + '<span class="countdown-amount">' + e.offset.minutes + '</span>' 2267 + '<span class="countdown-period">' + set_minute + '</span>' 2268 + '</span>'; 2269 }, e.offset.minutes, showZero); 2270 2271 addFormat(function() { 2272 format += '<span class="countdown-section">' 2273 + '<span class="countdown-amount">' + e.offset.seconds + '</span>' 2274 + '<span class="countdown-period">' + set_second + '</span>' 2275 + '</span>'; 2276 }, e.offset.seconds, showZero); 2277 2278 format += '</span>'; 2279 2280 $(this).html(format); 2281 }); 2282 }); 2283 } 2284}; 2285 2286$(document).ready(function() { 2287 2288 "use strict"; 2289 2290 countDown(true); 2291 2292 initProductOptions(); 2293}); 2294 2295/* products options */ 2296function initProductOptions(){ 2297 $('body').on('change', '.productitem-option1-combo-js select', function(e){ 2298 var $this = $(this).find('option:selected'); 2299 setNewData($this, true); 2300 var val = $this.attr("data-tag") + '-js'; 2301 var _parent = $this.closest('.tt-option-block'); 2302 val = _parent.optionsSetParams(val, '.productitem-option2-js'); 2303 _parent.optionsSetParams(val, '.productitem-option3-js'); 2304 }) 2305 $('body').on('click', '.productitem-option1-js a', function(e){ 2306 var $this = $(this); 2307 optionsHandler(e, $this); 2308 var val = $this.parent().attr("data-tag") + '-js'; 2309 var _parent = $this.closest('.tt-option-block'); 2310 val = _parent.optionsSetParams(val, '.productitem-option2-js'); 2311 _parent.optionsSetParams(val, '.productitem-option3-js'); 2312 }) 2313 $('body').on('click', '.productitem-option2-js a', function(e){ 2314 var $this = $(this) 2315 optionsHandler(e, $this); 2316 var val = $this.parent().attr("data-tag") + '-js'; 2317 var _parent = $this.closest('.tt-option-block'); 2318 _parent.optionsSetParams(val, '.productitem-option3-js'); 2319 }); 2320 $('body').on('click', '.productitem-option3-js a', function(e){ 2321 optionsHandler(e, $(this)); 2322 }); 2323} 2324function optionsHandler(e, $this){ 2325 e.preventDefault(); 2326 if($this.parent().hasClass('active')) return false;
2327 setNewData($this); 2328} 2329$.fn.optionsSetParams = function(val, str){ 2330 var _opt = this.find(str); 2331 if(_opt.length == 0) return false; 2332 _opt.show().find('li').each(function(){ $(this).hide().removeClass('active') }); 2333 if(_opt.find('[data-current-option="'+val+'"]').length == 0) return false; 2334 _opt.find('[data-current-option="'+val+'"]').show().first().addClass('active'); 2335 return _opt.find('.active').find('a').parent().attr("data-tag") + '-js'; 2336} 2337function setNewData($this, combobox){ 2338 if (combobox === undefined) { 2339 combobox = false; 2340 } 2341 var _parent = combobox ? $this : $this.parent(); 2342 if(!combobox){ 2343 _parent.parent().find(".active").removeClass('active'); 2344 _parent.addClass('active'); 2345 } 2346 2347 var availability = Boolean(_parent.data('variant_availability')); 2348 var $pr_parent = $this.closest('.options-js'); 2349 2350 $pr_parent.find('input').val(_parent.attr('data-var_id')); 2351 2352 var img_src = _parent.attr('data-img'); 2353 if(img_src != ''){ 2354 if($(window).width() > '1024' && $pr_parent.find('.tt-img-roll-over').length) { 2355 $pr_parent.find('.tt-img-roll-over img').attr('src', img_src).removeAttr('srcset data-src data-srcset').removeClass('lazyload'); 2356 } 2357 else{ 2358 $pr_parent.find('.tt-img img').attr('src', img_src).removeAttr('srcset data-src data-srcset').removeClass('lazyload'); 2359 } 2360 if($pr_parent.find('[data-mainimage]').length){ 2361 $pr_parent.find('[data-mainimage]').removeAttr('data-mainimage').parent().css('height', 'auto'); 2362 } 2363 } 2364 2365 var $btn = $pr_parent.find('.tt-btn-addtocart'); 2366 $btn.attr('href', '/cart/add.js?quantity=1&id='+_parent.attr('data-var_id')); 2367 2368 if($pr_parent.find('.compare-js').length){ 2369 $pr_parent.find('.compare-js').attr('data-compareid', _parent.attr('data-var_id')); 2370 $(window).trigger( "compareevent" ); 2371 } 2372 2373 availability ? $btn.html(_parent.attr('data-buttonname')).removeClass('disable') : $btn.html(unavailable_text).addClass('disable'); 2374 2375 var labelsale = $pr_parent.find('.tt-label-sale'); 2376 var mainprice = $pr_parent.find('.tt-price span:first-child'); 2377 var oldprice = $pr_parent.find('.old-price'); 2378 mainprice.html(Shopify.formatMoney(_parent.attr('data-price'), money_format)); 2379 var compprice = String(_parent.attr('data-compprice')); 2380 oldprice.html(Shopify.formatMoney(compprice, money_format)); 2381 if(!compprice) { 2382 !oldprice.hasClass('hide') && oldprice.addClass('hide'); 2383 mainprice.hasClass('new-price') && mainprice.removeClass('new-price'); 2384 labelsale.length && labelsale.hide(); 2385 } 2386 else { 2387 var _mainprice = Number(_parent.attr('data-price')); 2388 compprice = Number(compprice); 2389 if(_mainprice >= compprice){ 2390 !oldprice.hasClass('hide') && oldprice.addClass('hide'); 2391 mainprice.hasClass('new-price') && mainprice.removeClass('new-price'); 2392 labelsale.length && labelsale.hide(); 2393 } 2394 else{ 2395 oldprice.hasClass('hide') && oldprice.removeClass('hide'); 2396 !mainprice.hasClass('new-price') && mainprice.addClass('new-price'); 2397 var per = Math.round(100 - (_mainprice / compprice)*100)+'%'; 2398 labelsale.length && labelsale.show().find('.thumb_percent').html(per); 2399 } 2400 } 2401 2402 2403 /* variant_price = labelsale.data('price') 2404 percent = Math.round(100 - (variant.price / variant.compare_at_price)*100);*/ 2405 2406 2407 $('body').trigger('refreshCurrency'); 2408} 2409 2410/* Section */ 2411$(document) 2412.on('shopify:section:load', eventHandler) 2413.ready(function() { 2414 $('[data-sectionname]').each(function(){ $(this).initSection() }); 2415 $('[data-mainimage]').length && $(window).resize(initImagesSizeResize); 2416 initImagesSize('start'); 2417 lazyload(); 2418}); 2419 2420function eventHandler(e) { 2421 $('#' + e.target.id).find('[data-sectionname]').initSection(); 2422 initImagesSize(); 2423 lazyload(); 2424 if (Shopify.designMode && typeof "product_page_1_description_handler" === "function"){ 2425 $(document) 2426 .on('shopify:section:select', product_page_1_description_handler); 2427 } 2428} 2429 2430initImagesSize(); 2431function initImagesSizeResize(){ 2432 setTimeout(function(){initImagesSize('resize')}, 100) 2433} 2434function initImagesSize(e){ 2435 if(!$('[data-mainimage]').length) return false;
2436 $('[data-mainimage]').each(function(){ 2437 var _ = $(this), 2438 wn = _.closest('.respimgsize.product-parent').find('.tt-image-box').length ? _.closest('.respimgsize').find('.tt-image-box').width() : _.closest('.respimgsize').width(), 2439 w = Math.min(wn, 2000) + 'x', 2440 w2= wn*2 + 'x', 2441 i = _.attr('data-mainimage').replace('respimgsize', w), 2442 i2 = _.attr('data-mainimage').replace('respimgsize', w2), 2443 attr = _.attr('data-mainimageratio'); 2444 2445 if(w == '0x') return false; 2446 2447 var dwidth = _.attr('data-width'); 2448 if (typeof dwidth !== typeof undefined && dwidth !== false && !_.is(":visible")){ 2449 dwidth = Math.min(Number(dwidth), 2000); 2450 w = dwidth + 'x', 2451 w2= dwidth*2 + 'x', 2452 i = _.attr('data-mainimage').replace('respimgsize', w), 2453 i2 = _.attr('data-mainimage').replace('respimgsize', w2); 2454 } 2455 2456 _.attr('data-srcset', i+' 1x,'+i2+' 2x'); 2457 if(e == 'resize'){ 2458 _.attr('srcset', i+' 1x,'+i2+' 2x'); 2459 } 2460 if(e == 'start' && !_.closest('.product-parent').length){ 2461 setTimeout(function(){_.attr('srcset', i+' 1x,'+i2+' 2x')}, 3000); 2462 } 2463 if(!$('#same_product_height').length && _.closest('.product-parent').length){ 2464 var h = wn/Number(attr); 2465 _.parent().css('height', h).css('display', 'block'); 2466 } 2467 }) 2468} 2469 2470$.fn.initSection = function(){ 2471 var _ = this; 2472 var n = _.data('sectionname'); 2473 switch (n) { 2474 case ("index_sectionconstbann"): _.find('.contbanslider').initSlick(1, 1, 1,false); break; 2475 case ("index_sectionproducts"): var m = Number(_.find('.tt-carousel-products-js').attr('data-mobile')); 2476 var a = _.find('.tt-carousel-products-js').attr('data-adaptive') == "true" ? true: false; 2477 _.find('.tt-carousel-products-js').initSlick(3, m, m, a); break; 2478 case ("index_horizontaltabs"): _.initTabs(); break; 2479 case ("index_verticaltabs"): _.initTabs(1); break; 2480 case ("index_sectionlookbook"): _.find('.tt-carousel-lookbook').initSlickLookbook(3, 2, 1); break; 2481 case ("index_sectionlookbookmasonry"): _.find('.tt-lookbook-init').initMasonryLookbook(); break; 2482 case ("index_sectionmasonry_products"): _.find('.tt-product-index-init').initMasonryLookbook(); break; 2483 case ("index_brands"): _.find('.tt-carousel-brands').initSlickBrands(6, 4, 3, 2, 1); break; 2484 case ("index_testimonials"): _.find('.tt-slider-fullwidth').initSlick(1, 1, 1); break; 2485 case ("index_revolution"): _.find('.slider-revolution').initRevolution(); break; 2486 case ("index_iconbanners2"): _.find('.tt-single-text-with-icons').initSigleTextWithIcon(); break; 2487 case ("product-recommendations"): _.initProductPageRecommendations(); break; 2488 case ("index_productandvideosection"): _.initVideoProductSection(); break; 2489 case ("index_blurbssection"): _.find('.js-blurbs-slider').initBlurbssection(); _.find('.tt-blurbsreview-masonry').blurbsreviewMasonry(); break; 2490 case ("index_sectionsingleproduct"): _.initSingleProductSection(); break; 2491 2492 case ("productpagesection"): product_page_1_description_handler(); break; 2493 2494 default: break; 2495 } 2496} 2497 2498$.fn.initSingleProductSection = function(){ 2499 var _this = this, 2500 _select = _this.find('.col-select select'), 2501 _price = _this.find('.tt-price'), 2502 _loader = _this.find('.custom-loader'), 2503 _image_box = _this.find('.productandvideoimg'), 2504 _avaibility = _this.find('.availability'), 2505 _input = _this.find('.tt-input-counter').find('input'), 2506 u = _this.attr('data-prurl'); 2507 2508 addToCartHandler.initFormAddToCartButton(false, _this, false); 2509 2510 if(_avaibility.length){ 2511 var global_quantity_qw = {}; 2512 var qa = _this.attr('data-quantity').split(';'); 2513 if(qa.length > 0){ 2514 for(var i = 0; i < qa.length; i++){ 2515 if(qa[i] === '') break; 2516 var _qa = qa[i].split('-'); 2517 global_quantity_qw[_qa[0]] = _qa[1]; 2518 } 2519 } 2520 } 2521 2522 window.parent != window.top && _this.find('.tt-countdown_box_02').length && countDown(true); 2523 2524 Shopify.getProduct(u, productInfoJsonLoaded); 2525 function productInfoJsonLoaded(json){ 2526 var _var = _select.find('option:selected').length == 0 ? json.variants[0] : json.variants[_select.find('option:selected').index()]; 2527 _avaibility.length && swatchAvaibility(_var, _avaibility, _input, global_quantity_qw); 2528 _select.on('change', function(){ 2529 var i = $(this).find('option:selected').index(), 2530 variant = json.variants[i], 2531 src = variant.featured_image ? variant.featured_image.src.split('https:').pop() : json.featured_image.split('https:').pop(); 2532 2533 _this.find('[name="id"]').attr('value', variant.id); 2534 2535 if(src != _image_box.find('img').attr('src')){ 2536 var img = new Image(); 2537 img.onload = function() { 2538 _loader.length && _loader.stop().fadeOut(); 2539 _image_box.find('img').replaceWith(img); 2540 } 2541 _loader.length && _loader.stop().fadeIn(); 2542 img.src = src; 2543 } 2544 2545 if(_price.length){ 2546 var price_str = Shopify.formatMoney(variant.price, money_format); 2547 var price_comare_str = Shopify.formatMoney(variant.compare_at_price, money_format); 2548 if(variant.price < variant.compare_at_price){ 2549 _price.find('>span:first').addClass('new-price').html(price_str); 2550 _price.find('>span:last').removeClass('hide').html(price_comare_str); 2551 } 2552 else { 2553 _price.find('>span:first').removeClass('new-price').html(price_str); 2554 _price.find('>span:last').addClass('hide'); 2555 } 2556 } 2557 2558 _avaibility.length && swatchAvaibility(variant, _avaibility, _input, global_quantity_qw); 2559 var temp = global_quantity; 2560 global_quantity = global_quantity_qw; 2561 swatchVariantButtonHandler(_this, variant); 2562 global_quantity = temp; 2563 }) 2564 } 2565} 2566 2567$.fn.initBlurbssection = function(){ 2568 var _this = this; 2569 2570 wresizeHandler(); 2571 $(window).bind('resize', wresizeHandler); 2572 2573 function wresizeHandler(){ 2574 if($(window).width() < 576) 2575 !_this.hasClass('slick-slider') && setTimeout(initBlurbssectionSlider, 0); 2576 else 2577 _this.hasClass('slick-slider') && _this.slick('unslick'); 2578 } 2579 function initBlurbssectionSlider(){ 2580 _this.slick({ 2581 lazyLoad: 'progressive', 2582 dots: true,
2583 arrows: false, 2584 infinite: true, 2585 speed: 300, 2586 slidesToShow: 1, 2587 slidesToScroll: 1, 2588 adaptiveHeight: false 2589 }); 2590 } 2591} 2592 2593 2594$.fn.initVideoProductSection = function(){ 2595 var _ = this.find('video'); 2596 _.on('click touchstart', function(){ 2597 _[0].play(); 2598 _.css('cursor', 'default'); 2599 }) 2600 $(window).scroll({obj: _},videoProductscrollW).resize({obj: _},videoProductscrollW); 2601} 2602function videoProductscrollW(e){ 2603 var v = e.data.obj, 2604 wp = $(window).scrollTop(), 2605 wh = $(window).height(), 2606 p = v.offset().top, 2607 h = v.height(), 2608 dt = 0, 2609 db = 100; 2610 if(wp+wh > p+dt && wp < p+h-db){ 2611 v[0].play(); 2612 !v.hasClass('played') && v.addClass('played'); 2613 } 2614 else{ 2615 if(v.hasClass('played')){ 2616 v.removeClass('played'); 2617 v[0].pause(); 2618 } 2619 } 2620} 2621 2622$.fn.initTabs = function(mobilegrid){ 2623 mobilegrid = mobilegrid || 2; 2624 var _ = this; 2625 if(!_.find('[role="tabpanel"]').length) return false; 2626 var a = _.find('[role="tabpanel"]').first().find('.ajaxcontent'); 2627 getTabcontent(a, mobilegrid); 2628 2629 if(_.find('.nav-link').length){ 2630 _.on('mouseenter', function(){ 2631 $(this).unbind('mouseenter'); 2632 _.find('.nav-link').on('click', clickTabcontent).each(function(){ 2633 var href = $(this).attr('href'); 2634 getTabcontent($(href).find('.ajaxcontent'), mobilegrid); 2635 }) 2636 }) 2637 } 2638} 2639function clickTabcontent(){ 2640 var $this = $(this); 2641 setTimeout(function(){ 2642 $this.closest('[data-respjs]').find('.tab-pane.active').find('[data-mainimage]').each(function(){ 2643 var _ = $(this), 2644 wn = _.closest('.respimgsize').width(), 2645 w = wn + 'x', 2646 w2= wn*2 + 'x', 2647 i = _.attr('data-mainimage').replace('respimgsize', w), 2648 i2 = _.attr('data-mainimage').replace('respimgsize', w2), 2649 attr = _.attr('data-mainimageratio'); 2650 _.attr('data-srcset', i+' 1x,'+i2+' 2x').attr('srcset', i+' 1x,'+i2+' 2x'); 2651 if(!$('#same_product_height').length) { 2652 var h = wn/Number(attr); 2653 _.parent().css('height', h).css('display', 'block'); 2654 } 2655 }) 2656 }, 100); 2657 alignmentArrowValue(); 2658} 2659function getTabcontent(a, mobilegrid){ 2660 if(!a.length || !a.hasClass('startajax')) return false; 2661 a.removeClass('startajax') 2662 var url = '/collections/all?view=collectiontabshorizontal&constraint=' + a.attr('data-content'), 2663 params = { 2664 type: "get", 2665 url: url, 2666 success: function(data){ 2667 var check = !$('.tt-product .tt-product-inside-hover').length ? true : false; 2668 var check2 = !$('.product-parent').length ? true : false; 2669 2670 var p = a.parent(); 2671 a.replaceWith(data); 2672 if(a.hasClass('slider')){ 2673 2674 p.find('.tt-carousel-products-js').initSlick(3, 2, mobilegrid); 2675 alignmentArrowValue(); 2676 if($(".tt-rating").length > 0) { 2677 try { 2678 $.getScript(window.location.protocol + "//productreviews.shopifycdn.com/assets/v4/spr.js"); 2679 } catch (err) {} 2680 } 2681 } 2682 initImagesSize(); 2683 lazyload(); 2684 $('body').trigger('refreshCurrency'); 2685 ttProductSmall(); 2686 countDown(true); 2687 setTimeout(ttReinitflowProduct, 0); 2688 2689 if($('.tt-product .tt-product-inside-hover').length && check){ 2690 ttProductHover(); 2691 } 2692 if($('.product-parent').length && check2){ 2693 wl_handler.init(); 2694 compare.init(); 2695 } 2696 } 2697 } 2698 jQuery.ajax(params); 2699} 2700 2701$.fn.initProductPageRecommendations = function() { 2702 var productId = this.attr('data-product-id'), 2703 title = this.attr('data-title'), 2704 limit = this.attr('data-limit'), 2705 titleposition = this.attr('data-titleposition'), 2706 fullscreen = this.attr('data-fullscreen'), 2707 slickshow = this.attr('data-slickshow'), 2708 recommendationsSectionUrl = 2709 '/recommendations/products?§ion_id=product-recommendations&product_id=' + 2710 productId + 2711 '&limit='+limit; 2712 2713 $.get(recommendationsSectionUrl).then( 2714 function(section) { 2715 var recommendationsMarkup = $(section).html(); 2716 if (recommendationsMarkup.trim() !== '') { 2717 this.html(recommendationsMarkup); 2718 lazyload(); 2719 this.find('.tt-title-small').html(title).parent().addClass(titleposition); 2720 fullscreen == "true" && this.find('.tt-block-title').parent().removeClass('container').addClass('container-fluid-custom'); 2721 this.find('.tt-carousel-products').attr('data-slick', '{"slidesToShow": '+sl
2721ickshow+', "slidesToScroll": '+slickshow+'}').initSlick(3, 2, 2); 2722 alignmentArrowValue(); 2723 initImagesSize(); 2724 } 2725 }.bind(this) 2726 ); 2727} 2728 2729$.fn.initSigleTextWithIcon = function() { 2730 var $singletextwithicons = this; 2731 sigleTextWithIconHandler(); 2732 $(window).resize(sigleTextWithIconHandler); 2733 function sigleTextWithIconHandler(){ 2734 $(window).width() > 1024 ? unslickSigleTextWithIcon() : initSlickSigleTextWithIcon(); 2735 } 2736 2737 function initSlickSigleTextWithIcon(){ 2738 if($singletextwithicons.hasClass('slick-slider')) return false; 2739 $singletextwithicons.slick({ 2740 dots: false, 2741 arrows: false, 2742 infinite: true, 2743 adaptiveHeight: true, 2744 slidesToShow: 6, 2745 slidesToScroll: 1, 2746 responsive: 2747 [ 2748 { 2749 breakpoint: 1025, 2750 settings: { 2751 slidesToShow: 2, 2752 slidesToScroll: 1 2753 } 2754 }, 2755 { 2756 breakpoint: 500, 2757 settings: { 2758 slidesToShow: 1, 2759 slidesToScroll: 1 2760 } 2761 } 2762 ] 2763 }); 2764 } 2765 function unslickSigleTextWithIcon(){ 2766 2767 if(!$singletextwithicons.hasClass('slick-slider')) return false; 2768 setTimeout(function(){$singletextwithicons.slick('unslick');}, 200); 2769 2770 } 2771} 2772 2773$.fn.initSlick = function(md, sm, xs,adaheight) { 2774 adaheight = adaheight == false ? false : true; 2775 this.slick({ 2776 dots: false, 2777 arrows: true, 2778 infinite: true, 2779 adaptiveHeight: adaheight, 2780 responsive: 2781 [ 2782 { 2783 breakpoint: 1025, 2784 settings: { 2785 slidesToShow: md, 2786 slidesToScroll: md 2787 } 2788 }, 2789 { 2790 breakpoint: 769, 2791 settings: { 2792 slidesToShow: sm, 2793 slidesToScroll: sm 2794 } 2795 }, 2796 { 2797 breakpoint: 480, 2798 settings: { 2799 slidesToShow: xs, 2800 slidesToScroll: xs 2801 } 2802 } 2803 ] 2804 }); 2805} 2806 2807$.fn.initSlickBrands = function(md, sm, sm2, xs, xs2) { 2808 this.slick({ 2809 dots: false, 2810 arrows: true, 2811 infinite: true, 2812 adaptiveHeight: true, 2813 responsive: [ 2814 { 2815 breakpoint: 1230, 2816 settings: { 2817 slidesToShow: md, 2818 slidesToScroll: md 2819 } 2820 }, 2821 { 2822 breakpoint: 1025, 2823 settings: { 2824 slidesToShow: sm, 2825 slidesToScroll: sm 2826 } 2827 }, 2828 { 2829 breakpoint: 790, 2830 settings: { 2831 slidesToShow: sm2, 2832 slidesToScroll: sm2 2833 } 2834 }, 2835 { 2836 breakpoint: 576, 2837 settings: { 2838 slidesToShow: xs, 2839 slidesToScroll: xs 2840 } 2841 }, 2842 { 2843 breakpoint: 380, 2844 settings: { 2845 slidesToShow: xs2, 2846 slidesToScroll: xs2 2847 } 2848 } 2849 ] 2850 }); 2851}; 2852 2853// carusel 2854$.fn.initSlickLookbook = function(md, sm, xs) { 2855 this.slick({ 2856 dots: true, 2857 arrows: true, 2858 infinite: true, 2859 adaptiveHeight: true, 2860 responsive: 2861 [ 2862 { 2863 breakpoint: 1025, 2864 settings: { 2865 slidesToShow: sm, 2866 slidesToScroll: sm 2867 } 2868 }, 2869 { 2870 breakpoint: 790, 2871 settings: { 2872 slidesToShow: xs, 2873 slidesToScroll: xs 2874 } 2875 } 2876 ] 2877 }); 2878}; 2879$.fn.initMasonryLookbook = function() { 2880 if($('body').find('.isotope_included').length == 0) 2881 { 2882 this.replaceWith('<span class="text-center" style="display: inherit;">Save and reload page.</span>'); 2883 return false; 2884 } 2885 2886 var _ = this; 2887 2888 var iso = _.isotope({ 2889 itemSelector: '.element-item', 2890 layoutMode: 'masonry', 2891 gutter: 0 2892 }); 2893 // layout Isotope after each image loads 2894 iso.imagesLoaded().progress( function(index) { 2895 iso.addClass('tt-show').isotope('layout'); 2896 }); 2897} 2898 2899$.fn.blurbsreviewMasonry = function() { 2900 if(!this.length) return false; 2901 var _this = this 2902 var isActive = false; 2903 2904 brmHandler(); 2905 $(window).bind('resize', brmHandler); 2906 2907 function brmHandler(){ 2908 if($(window).width() < 576){ 2909 if (isActive){ 2910 _this.removeClass('tt-show').isotope('destroy'); 2911 isActive = false; 2912 } 2913 } 2914 else{ 2915 if (!isActive){ 2916 _this.initMasonryLookbook(); 2917 isActive = true; 2918 } 2919 } 2920 } 2921} 2922 2923//REVOLUTION SLIDER (function to reset the plug on the breakpoints) 2924 2925$.fn.initRevolution = function(){ 2926 2927 if($('body').find('.revolution_included').length == 0) 2928 { 2929 this.replaceWith('<span class="text-center" style="display: inherit;">Save and reload page.</span>'); 2930 return false;
2931 } 2932 2933 function click_to_play_video() { 2934 var $this = $(this), 2935 $video = $this.find('li video'); 2936 2937 if (!$video.length) return; 2938 2939 $video.on('play', function() { 2940 var $btn = $(this).parents('li').find('.video-play'); 2941 2942 $btn.addClass('pause'); 2943 $(this).parents('.tp-caption.fullscreenvideo').addClass('click-video'); 2944 }); 2945 2946 $video.on('pause ended', function() { 2947 var $btn = $(this).parents('li').find('.video-play'); 2948 2949 $btn.removeClass('pause'); 2950 }); 2951 2952 $this.find('.video-play').on('click', function(e) { 2953 var $video = $(this).parents('li').find('video'); 2954 2955 $video.trigger('click'); 2956 e.preventDefault(); 2957 e.stopPropagation(); 2958 return false; 2959 }); 2960 2961 $this.on('revolution.slide.onbeforeswap', function(event, data) { 2962 $(this).find('.tp-caption.fullscreenvideo').removeClass('click-video'); 2963 }); 2964 }; 2965 2966 function autoplay_video(elem) { 2967 var $get_sliders = $(this); 2968 2969 $get_sliders.each(function() { 2970 var $slider = $(this); 2971 2972 var set_event = function() { 2973 $slider.on('revolution.slide.onchange', function(event, data) { 2974 var $this = $(this), 2975 $active_slide = $this.find('li').eq(data.slideIndex - 1), 2976 $video = $active_slide.find('video'), 2977 autoplay = $active_slide.find('.tp-caption').attr('data-autoplay'); 2978 2979 if ($video.length && autoplay === 'true') { 2980 var video = $video.get(0); 2981 2982 video.currentTime = 0; 2983 2984 $slider.one('revolution.slide.onafterswap', function(event, data) { 2985 if (video.paused) { 2986 video.play(); 2987 } 2988 }); 2989 } 2990 }); 2991 }; 2992 2993 if ($slider.hasClass('revslider-initialised')) { 2994 set_event(); 2995 } else { 2996 $slider.one('revolution.slide.onloaded', function() { 2997 set_event(); 2998 }); 2999 } 3000 }); 3001 }; 3002 3003 $.fn.resizeRevolution = function(options, new_rev_obj, bp_arr, revdelay) { 3004 if (!$(this).length || !$(options.slider).length || !options.breakpoints) return false; 3005 3006 var wrapper = this, 3007 slider = options.slider, 3008 breakpoints = options.breakpoints, 3009 fullscreen_BP = options.fullscreen_BP || false, 3010 new_rev_obj = new_rev_obj || {}, 3011 bp_arr = bp_arr || [], 3012 rev_obj = { 3013 dottedOverlay: "none", 3014 delay: revdelay, 3015 startwidth: 1920, 3016 hideThumbs: 200, 3017 hideTimerBar: "on", 3018 3019 thumbWidth: 100, 3020 thumbHeight: 50, 3021 thumbAmount: 5, 3022 3023 navigationArrows: "none", 3024 3025 touchenabled: "on", 3026 onHoverStop: "on", 3027 3028 swipe_velocity: 0.7, 3029 swipe_min_touches: 1, 3030 swipe_max_touches: 1, 3031 drag_block_vertical: false, 3032 3033 parallax: "mouse", 3034 parallaxBgFreeze: "on", 3035 parallaxLevels: [7, 4, 3, 2, 5, 4, 3, 2, 1, 0], 3036 3037 keyboardNavigation: "off", 3038 3039 navigationHAlign: "center", 3040 navigationVAlign: "bottom", 3041 navigationHOffset: 0, 3042 navigationVOffset: 20, 3043 3044 soloArrowLeftHalign: "left", 3045 soloArrowLeftValign: "center", 3046 soloArrowLeftHOffset: 20, 3047 soloArrowLeftVOffset: 0, 3048 3049 soloArrowRightHalign: "right", 3050 soloArrowRightValign: "center", 3051 soloArrowRightHOffset: 20, 3052 soloArrowRightVOffset: 0, 3053 3054 shadow: 0, 3055 3056 spinner: "", 3057 h_align: "left", 3058 3059 stopLoop: "off", 3060 stopAfterLoops: -1, 3061 stopAtSlide: -1, 3062 3063 shuffle: "off", 3064 3065 autoHeight: "off", 3066 forceFullWidth: "off", 3067 3068 hideThumbsOnMobile: "off", 3069 hideNavDelayOnMobile: 1500, 3070 hideBulletsOnMobile: "off", 3071 hideArrowsOnMobile: "off", 3072 hideThumbsUnderResolution: 0, 3073 3074 hideSliderAtLimit: 0, 3075 hideCaptionAtLimit: 0, 3076 hideAllCaptionAtLilmit: 0, 3077 startWithSlide: 0, 3078 fullScreenOffsetContainer: "" 3079 }; 3080 3081 $.extend(rev_obj, new_rev_obj); 3082 3083 var get_Slider = function($sliderWrapp) { 3084 return $sliderWrapp.find(slider); 3085 }; 3086 3087 var get_current_bp = function() { 3088 var wind_W = window.innerWidth; 3089 3090 for (var i = 0; i < breakpoints.length; i++) { 3091 var bp = breakpoints[i]; 3092 3093 if (!breakpoints.length) return false;
3094 3095 if (wind_W <= bp) { 3096 if (i === 0) { 3097 return bp; 3098 } else { 3099 if (bp > breakpoints[i - 1]) 3100 return bp; 3101 } 3102 } else if (wind_W > bp && i === breakpoints.length - 1) 3103 return Infinity; 3104 } 3105 return false; 3106 }; 3107 3108 var $sliderWrappers = $(wrapper); 3109 3110 $sliderWrappers.each(function() { 3111 var $sliderWrapp = $(this), 3112 $sliderInit = get_Slider($sliderWrapp), 3113 $sliderCopy = $sliderWrapp.clone(), 3114 bp = get_current_bp(); 3115 3116 if (!$sliderInit.length) return false; 3117 3118 var start_Rev = function($sliderInit, bp) { 3119 var wind_W = window.innerWidth, 3120 rev_settings_obj = {}, 3121 rev_screen_obj = {}, 3122 set_rev_obj = {}; 3123 3124 if (fullscreen_BP) { 3125 var full_width = (wind_W >= fullscreen_BP) ? 'off' : 'on', 3126 full_screen = (wind_W >= fullscreen_BP) ? 'on' : 'off'; 3127 3128 rev_screen_obj = { 3129 fullWidth: full_width, 3130 fullScreen: full_screen 3131 }; 3132 } 3133 3134 if (bp_arr.length) { 3135 for (var i = 0; i < bp_arr.length; i++) { 3136 var this_obj = bp_arr[i]; 3137 3138 if (this_obj.bp && this_obj.bp.length === 2 && this_obj.bp[0] < this_obj.bp[1]) { 3139 var from = this_obj.bp[0], 3140 to = this_obj.bp[1]; 3141 3142 if (from <= bp && to >= bp) { 3143 for (var key in this_obj) { 3144 if (key !== 'bp') 3145 rev_settings_obj[key] = this_obj[key]; 3146 } 3147 } 3148 } 3149 } 3150 } 3151 3152 $.extend(set_rev_obj, rev_obj, rev_settings_obj, rev_screen_obj); 3153 3154 $($sliderInit).show().revolution(set_rev_obj); 3155 3156 $(options.functions).each(function() { 3157 this.call($sliderInit); 3158 }); 3159 }; 3160 3161 start_Rev($sliderInit, bp); 3162 3163 var restart_Rev = function(current_bp) { 3164 if (!$($sliderInit).hasClass('revslider-initialised')) return; 3165 bp = current_bp || 0; 3166 $sliderInit.revkill(); 3167 $sliderWrapp.replaceWith($sliderCopy); 3168 $sliderWrapp = $sliderCopy; 3169 $sliderCopy = $sliderWrapp.clone(); 3170 $sliderInit = get_Slider($sliderWrapp); 3171 start_Rev($sliderInit, bp); 3172 }; 3173 3174 function endResize(func) { 3175 var windWidth = window.innerWidth, 3176 interval; 3177 3178 interval = setInterval(function() { 3179 var windWidthInterval = window.innerWidth; 3180 if (windWidth === windWidthInterval) { 3181 setTimeout(function() { 3182 func(); 3183 }, 200); 3184 } 3185 clearInterval(interval); 3186 }, 100); 3187 }; 3188 3189 $(window).on('resize', function() { 3190 endResize(function() { 3191 var current_bp = get_current_bp(); 3192 if (current_bp !== bp) 3193 restart_Rev(current_bp); 3194 }) 3195 }); 3196 }); 3197 }; 3198 3199 var delay = this.data('speed'), 3200 fullscreen = this.attr('data-fullscreen') == 'false' ? false : 768, 3201 width = this.attr('data-width'), 3202 height = this.attr('data-height'); 3203 3204 if(this.hasClass('revolution-default')) { 3205 this.resizeRevolution( 3206 { 3207 slider: '.tp-banner', 3208 breakpoints: [414, 767, 1025], 3209 fullscreen_BP: fullscreen, 3210 functions: [ 3211 click_to_play_video, 3212 autoplay_video 3213 ] 3214 }, 3215 { 3216 fullScreenOffsetContainer: "header", 3217 navigationArrows: "true", 3218 startwidth: width || 1920, 3219 startheight: height || 800 3220 }, 3221 [ 3222 { 3223 bp: [0, 768], 3224 startheight: height || 1200 3225 } 3226 ], 3227 delay 3228 ); 3229 } 3230 else { 3231 this.resizeRevolution( 3232 { 3233 slider: '.tp-banner', 3234 breakpoints: [414, 767, 1025], 3235 fullscreen_BP: fullscreen, 3236 functions: [ 3237 click_to_play_video, 3238 autoplay_video 3239 ] 3240 }, 3241 { 3242 fullScreenOffsetContainer: "header-static", 3243 startwidth: width || 1920, 3244 startheight: height || 800 3245 }, 3246 [ 3247 { 3248 bp: [0, 768], 3249 startheight: height || 1200 3250 }, 3251 { 3252 bp: [0, 1025], 3253 fullScreenOffsetContainer: "header" 3254 } 3255 ], 3256 delay 3257 ); 3258 } 3259} 3260 3261$('body').on( 3262 'click', '.tt-review, .tt-rating', function(e){ 3263 if($("[data-ali]").length) { 3264 alireviewApp($("[data-ali]").attr('data-ali')); 3265 return false;
3266 } 3267 if($(this).closest('.tt-review').length) { 3268 $('#tab_review').length && findAndViewReviews(); 3269 } 3270 else{ 3271 window.location = $(this).closest('.tt-rating').data('url') + '?tab_review'; 3272 } 3273 } 3274) 3275function alireviewApp(val){ 3276 var $id = '#'+val; 3277 var y = $($id).offset().top; 3278 var d = $('.tt-stuck-nav').length && $('.tt-stuck-nav.disabled').length == 0 ? $('.tt-stuck-nav').height() : 0; 3279 $('html, body').animate({ 3280 scrollTop: y-d*2 3281 }, 500); 3282} 3283$(document).ready(function() { 3284 var s = window.location.search; 3285 if($("[data-ali]").length && s.indexOf('tab_review') > -1){ 3286 setTimeout(function(){alireviewApp($("[data-ali]").attr('data-ali'))}, 2000); 3287 return false; 3288 } 3289 if(s.indexOf('tab_review') == -1 || $('#tab_review').length == 0) return false; 3290 setTimeout(findAndViewReviews, 2000); 3291}); 3292function findAndViewReviews(){ 3293 var y = $('#tab_review').offset().top; 3294 var d = $('.tt-stuck-nav').length && $('.tt-stuck-nav.disabled').length == 0 ? $('.tt-stuck-nav').height() : 0; 3295 $('html, body').animate({ 3296 scrollTop: y-d 3297 }, 500); 3298 if($('#tab_review').hasClass('nav-link')){ 3299 $('#tab_review').trigger('click'); 3300 } 3301 else{ 3302 !$('#tab_review').hasClass('active') && $('#tab_review').find('.tt-collapse-title').trigger('click'); 3303 } 3304} 3305 3306/* Search autocomplite */ 3307$(function() { 3308 // Current Ajax request. 3309 var currentAjaxRequest = null; 3310 // Grabbing all search forms on the page, and adding a .search-results list to each. 3311 var searchForms = $('form[action*="/search"]').each(function() { 3312 // Grabbing text input. 3313 var input = $(this).find('input[name="q"]'); 3314 // Adding a list for showing search results. 3315 var offSet = input.position().top + input.innerHeight() + 1; 3316 $('<div class="search-results"></div>').appendTo($(this)).hide(); 3317 // Listening to keyup and change on the text field within these search forms. 3318 input.attr('autocomplete', 'off').bind('keyup change', function() { 3319 // What's the search term? 3320 var term = $(this).val(); 3321 // What's the search form? 3322 var form = $(this).closest('form'); 3323 // What's the search URL? 3324 var searchURL = '/search?type=product&q=' + term; 3325 // What's the search results list? 3326 var resultsList = form.find('.search-results'); 3327 // If that's a new term and it contains at least 3 characters. 3328 if (term.length > 3 && term != $(this).attr('data-old-term')) { 3329 // Saving old query. 3330 $(this).attr('data-old-term', term); 3331 // Killing any Ajax request that's currently being processed. 3332 if (currentAjaxRequest != null) currentAjaxRequest.abort(); 3333 // Pulling results. 3334 currentAjaxRequest = $.getJSON(searchURL + '&view=json', function(data) { 3335 // Reset results. 3336 resultsList.empty(); 3337 // If we have no results. 3338 if(data.results_count == 0) { 3339 resultsList.hide(); 3340 } else { 3341 var resultsList_ul = resultsList.append('<ul></ul>'); 3342 resultsList_ul = resultsList_ul.find('ul'); 3343 // If we have results. 3344 $.each(data.results, function(index, item) { 3345 if(index >= 6) return false; 3346 var link = $('<a></a>').attr('href', item.url); 3347 link.append('<div class="thumbnail"><img src="' + item.thumbnail + '" /></div>'); 3348 link.append('<div class="tt-description"><div class="tt-title">' + item.title + '</div></div>'); 3349 link.wrap('<li></li>'); 3350 resultsList_ul.append(link.parent()); 3351 }); 3352 // The Ajax request will return at the most 10 results. 3353 // If there are more than 10, let's link to the search results page. 3354 if(data.results_count > 6) { 3355 resultsList.append('<div class="tt-view-all"><a href="' + searchURL + '">'+seeallresults+' (' + data.results_count + ')</a></div>'); 3356 } 3357 resultsList.fadeIn(200); 3358 } 3359 }); 3360 } 3361 }); 3362 }); 3363 // Clicking outside makes the results disappear. 3364 $('body').bind('click', function(){ 3365 $('.search-results').hide(); 3366 }); 3367}); 3368 3369if($('[data-respjs="index_sectiontabs"]').length || $('.tt-carousel-products-js').length || $('.tt-carousel-products').length) initProductsSlickResize(); 3370function initProductsSlickResize(){ 3371 $(window).resize(function(){ 3372 $('.tt-carousel-products').length && $('.tt-carousel-products').slick('setPosition'); 3373 $('.tt-carousel-products-js').length && $('.tt-carousel-products-js').slick('setPosition'); 3374 alignmentArrowValue(); 3375 }) 3376} 3377 3378$(document).ready(function() { 3379 if($(".menu_language_holder").length == 0) return false;
3380 setTimeout(wgDefault, 100); 3381}); 3382function wgDefault(){ 3383 if($(".wg-default").length == 0) return false; 3384 var css_link = $(".menu_language_holder").data("css"); 3385 var wgDefault = $(".wg-default").detach().addClass("menu_language_holder"); 3386 var $ul = $(".menu_language_holder"); 3387 $ul.replaceWith(wgDefault); 3388 $('<link href="' + css_link + '" rel="stylesheet" type="text/css" media="all">').appendTo('body'); 3389} 3390 3391var tooltip = { 3392 html_i: '#tt-tooltip-popup', 3393 html_s: '<div id="tt-tooltip-popup"><span>', 3394 html_e: '</span><i></i></div>', 3395 tp_attr: '[data-tooltip]', 3396 tp_mod: false, 3397 init: function(){ 3398 this.tp_mod = this.get_tp_mod(); 3399 if(!this.tp_mod.length || /Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent)) return false; 3400 this.handler(); 3401 }, 3402 get_tp_attr: function(){ 3403 return this.tp_attr; 3404 }, 3405 get_tp_mod: function(){ 3406 return $(this.get_tp_attr()); 3407 }, 3408 get_w_width: function(){ 3409 return window.innerWidth || $window.width(); 3410 }, 3411 get_html_obj: function(name){ 3412 return this.html_s + name + this.html_e; 3413 }, 3414 check_pr_page_swatches: function($obj){ 3415 var swc = $obj.closest('.tt-swatches-container'); 3416 var search = $obj.closest('.tt-search'); 3417 var qv = $obj.closest('.tt-btn-quickview'); 3418 var cc = $obj.closest('.tt-collapse-content'); 3419 var wl = $obj.closest('.wlbutton-js'); 3420 var co = $obj.closest('.compare-js'); 3421 if(!swc.length && !search.length && !qv.length && !cc.length && !wl.length && !co.length) return false; 3422 return true; 3423 }, 3424 handler: function(){ 3425 var _ = this; 3426 $('body').on('mouseenter mouseleave', this.get_tp_attr(), function(e){ 3427 var ww = _.get_w_width(); 3428 if(ww <= 1024) return false; 3429 if (e.type === 'mouseenter') _.onHover($(this)); 3430 if (e.type === 'mouseleave') _.offHover($(this)); 3431 }); 3432 }, 3433 onHover: function($obj){ 3434 var _ = this, 3435 value = $obj.attr('data-tooltip'), 3436 $o = $(this.get_html_obj(value)), 3437 tposition = $obj.attr('data-tposition'), 3438 ftag = $obj.attr('data-findtag'); 3439 3440 if(value == "") return false; 3441 3442 $body.append($o); 3443 3444 var $objforsize = typeof ftag != 'undefined' ? $obj.find(ftag).first() : $obj, 3445 th = $o.innerHeight(), 3446 tw = $o.innerWidth(), 3447 oh = $objforsize.innerHeight(), 3448 ow = $objforsize.innerWidth(), 3449 v = $objforsize.offset().top, 3450 h = $objforsize.offset().left; 3451 3452 tposition = typeof tposition != 'undefined' ? tposition : 'top'; 3453 3454 if(tposition == 'top'){ 3455 v += - th - 20; 3456 h += parseInt((ow - tw)/2); 3457 } 3458 if(tposition == 'bottom'){ 3459 v += oh + 24; 3460 h += parseInt((ow - tw)/2); 3461 } 3462 if(tposition == 'left'){ 3463 v += parseInt((oh-th)/2); 3464 h += - tw - 24; 3465 } 3466 if(tposition == 'right'){ 3467 v += parseInt((oh-th)/2); 3468 h += ow + 24; 3469 } 3470 3471 this.showTooltip($o, h, v, tposition); 3472 3473 if(!this.check_pr_page_swatches($obj)) return false; 3474 $obj.on('click.closeTooltip', function(){ 3475 _.offHover($(this)); 3476 $(this).unbind( "click.closeTooltip" ); 3477 }) 3478 }, 3479 offHover: function($obj){ 3480 $body.find(this.html_i).remove(); 3481 3482 if(!this.check_pr_page_swatches($obj)) return false; 3483 $obj.unbind( "click.closeTooltip" ); 3484 }, 3485 showTooltip: function($o, h, v, p){ 3486 p = p || 'top'; 3487 var a = {opacity: 1}, 3488 k = p; 3489 if(k == 'bottom') k = 'top'; 3490 if(k == 'right') k = 'left'; 3491 3492 a[k] = p == 'bottom' || p == 'right' ? '-=10px' : '+=10px'; 3493 3494 $o.css({'top': v, 'left' : h}).addClass('tooltip-' + p).animate(a, 200); 3495 } 3496} 3497$(document).ready(function() { 3498 tooltip.init(); 3499}); 3500 3501var wl_handler = { 3502 search: '&view=wishlist', 3503 a_a: 'wk-add',
3504 a_d: 'wk-remove', 3505 space: 'wokiee_wishlist', 3506 com_json: {}, 3507 com_count: 0, 3508 com_limit: 0, 3509 init: function(){ 3510 this.wishlistpage(); 3511 3512 var _ = this; 3513 this.selected(); 3514 3515 $('body').on('click', '.wlbutton-js', function(e){ 3516 e.preventDefault(); 3517 var $this = $(this); 3518 $this.attr('data-action') == _.a_a ? wl_handler.setdata($this) : wl_handler.deletedata($this); 3519 _.setItemLengthInBadge(); 3520 }); 3521 }, 3522 wishlistpage: function(){ 3523 $('.wkpageinfo').removeClass('hide'); 3524 if(!$('.wkpageinfo').length || !this.checkEmptyPage()) return false 3525 3526 $('.wkpagenoinfo').addClass('hide'); 3527 3528 var _ = this, 3529 l = $.parseJSON(localStorage[wl_handler.space]); 3530 3531 this.com_limit = _.getjsonsize(l); 3532 3533 $.each(l, function(index, value){ 3534 _.getproduct(index, value); 3535 }); 3536 }, 3537 getproduct: function(id, url){ 3538 var _ = this, 3539 u = url+'?'+this.search; 3540 var params = { 3541 type: "get", 3542 url: u, 3543 success: function(data) { 3544 $(".tt-layout-product-item").append(data); 3545 3546 $('body').trigger('refreshCurrency'); 3547 if($(".spr-badge").length > 0) { 3548 $.getScript(window.location.protocol + "//productreviews.shopifycdn.com/assets/v4/spr.js"); 3549 } 3550 ttProductSmall(); 3551 3552 initImagesSize(); 3553 lazyload(); 3554 setTimeout(ttReinitflowProduct, 3000); 3555 }, 3556 error: function(XMLHttpRequest, textStatus) { 3557 console.log('product not found'); 3558 } 3559 }; 3560 jQuery.ajax(params); 3561 }, 3562 selectItems: function(){ 3563 this.selected(); 3564 }, 3565 setdata: function($obj){ 3566 var _ = this, 3567 d = localStorage[wl_handler.space], 3568 da = $obj.attr('href'), 3569 value = this.getid($obj); 3570 3571 d = d === undefined || d === "undefined" ? false : d; 3572 3573 if(d){ 3574 d = $.parseJSON(d); 3575 d[value] = da; 3576 d = JSON.stringify(d); 3577 } 3578 else{ 3579 var d = '{"'+value+'": "'+da+'"}'; 3580 } 3581 3582 localStorage[wl_handler.space] = d; 3583 3584 this.setPageButtonText($obj, 'data-prpage-rem'); 3585 $obj.attr('data-action', _.a_d).attr('data-tooltip', $obj.attr('data-remove')); 3586 $obj.is(':hover') && $obj.trigger('mouseleave').trigger('mouseenter'); 3587 }, 3588 deletedata: function($obj){ 3589 var value = this.getid($obj), 3590 l = localStorage[wl_handler.space]; 3591 3592 if(l === undefined || l === "undefined"){ 3593 $obj.attr('data-action', this.a_a); 3594 return false; 3595 } 3596 l = $.parseJSON(l); 3597 3598 this.deleteitem(value); 3599 3600 if(l.hasOwnProperty(value) && $('.wkpageinfo').length){ 3601 $obj.closest('.tt-item').fadeOut(function(){ 3602 $(this).remove(); 3603 wl_handler.checkEmptyPage(); 3604 }); 3605 return false; 3606 } 3607 3608 this.setPageButtonText($obj, 'data-prpage-add'); 3609 $obj.attr('data-action', this.a_a).attr('data-tooltip', $obj.attr('data-add')); 3610 $obj.is(':hover') && $obj.trigger('mouseleave').trigger('mouseenter'); 3611 }, 3612 deleteitem: function(value){ 3613 var l = $.parseJSON(localStorage[wl_handler.space]) 3614 if(l.hasOwnProperty(value)){ 3615 var count = wl_handler.getjsonsize(l); 3616 if(count > 1){ 3617 delete l[value]; 3618 l = JSON.stringify(l); 3619 localStorage[wl_handler.space] = l; 3620 } 3621 else{ 3622 localStorage.removeItem(wl_handler.space); 3623 } 3624 } 3625 }, 3626 getid: function($obj){ 3627 return $obj.attr('data-productid'); 3628 }, 3629 getjsonsize: function(value){ 3630 return Object.keys(value).length; 3631 }, 3632 setPageButtonText: function(o, attr){ 3633 if(o.hasClass('prpagebtn-js')){ 3634 var s = o.attr(attr); 3635 o.find('span').text(s); 3636 } 3637 }, 3638 selected: function(){ 3639 var d = localStorage[wl_handler.space]; 3640 if(d = d === undefined || d === "undefined") return false; 3641 3642 var _ = this, 3643 l = $.parseJSON(localStorage[wl_handler.space]); 3644 $.each(l, function (index, value) { 3645 var o = $('[data-productid="'+index+'"]'); 3646 o.length && o.attr('data-action', _.a_d).attr('data-tooltip', o.attr('data-remove')); 3647 _.setPageButtonText(o, 'data-prpage-rem'); 3648 }); 3649 }, 3650 checkEmptyPage: function(){ 3651 var d = localStorage[wl_handler.space]; 3652 if(d = d === undefined || d === "undefined"){ 3653 $('.wkpagenoinfo').removeClass('hide_opacity'); 3654 $('.wkpagenoinfo').removeClass('hide'); 3655 return false;
3656 } 3657 return true; 3658 }, 3659 setItemLengthInBadge: function(){ 3660 var l = localStorage[wl_handler.space]; 3661 if(l === undefined || l === "undefined"){ 3662 $('.tt-wishlist').length && $('.tt-wishlist').find('.tt-badge').hide(); 3663 return false; 3664 } 3665 l = $.parseJSON(l); 3666 l = Object.keys(l).length; 3667 $('.tt-wishlist').length && $('.tt-wishlist').find('.tt-badge').show().text(l); 3668 } 3669} 3670wl_handler.init(); 3671wl_handler.setItemLengthInBadge(); 3672 3673var ct = { 3674 mainc: '.tt-compare-table-js', 3675 slider: $('#tt-compare-table').find('.compare-init-slider'), 3676 init: function(){ 3677 if(!$(this.mainc).length) return false; 3678 $(window).resize(ct.resizeHandler); 3679 }, 3680 handler: function(){ 3681 var a = this.getSizes(); 3682 this.setSizes(a); 3683 this.slider.slick('slickGoTo', 0); 3684 $('.tt-compare-table').removeAttr('style'); 3685 a = false; 3686 setTimeout(function(){ 3687 ct.replaceSliderArrows($('.tt-image-box-last').first().position().top); 3688 }, 200) 3689 }, 3690 setSizes: function(a){ 3691 $(this.mainc).each(function(){ 3692 $(this).children().each(function(index){ 3693 $(this).outerHeight(a[index]); 3694 }); 3695 }) 3696 }, 3697 getSizes: function(){ 3698 var a = []; 3699 $(this.mainc).each(function(){ 3700 $(this).children().each(function(index){ 3701 a[index] = typeof a[index] != 'undefined' ? a[index] : 0; 3702 a[index] = Math.max(a[index], $(this).outerHeight()); 3703 }); 3704 }) 3705 return a 3706 }, 3707 resizeHandler: function(t){ 3708 t = t || 100; 3709 $('.tt-compare-table').css({opacity: 0}) 3710 $(ct.mainc).children().removeAttr('style'); 3711 $(ct.mainc).find('.tt-btn-addtocart').removeAttr('style'); 3712 setTimeout(function(){ 3713 ct.handler(); 3714 }, t); 3715 }, 3716 replaceSliderArrows: function(h){ 3717 var prev = $('.compare-init-slider').find('.slick-prev'), 3718 next = $('.compare-init-slider').find('.slick-next'), 3719 bh = prev.height(), 3720 c = parseInt((h-bh)/2); 3721 3722 prev.addClass('showarr').css({top: c}); 3723 next.addClass('showarr').css({top: c}); 3724 }, 3725 sliderinit: function(){ 3726 this.slider.slick({ 3727 dots: false, 3728 arrows: true, 3729 infinite: true, 3730 speed: 300, 3731 slidesToShow: 3, 3732 slidesToScroll: 1, 3733 adaptiveHeight: true, 3734 responsive: [ 3735 { 3736 breakpoint: 1025, 3737 settings: { 3738 slidesToShow: 2, 3739 } 3740 }, 3741 { 3742 breakpoint: 790, 3743 settings: { 3744 slidesToShow: 1 3745 } 3746 } 3747 ] 3748 }); 3749 }, 3750 sliderunslick: function(){ 3751 this.slider.slick('unslick'); 3752 } 3753} 3754var compare = { 3755 search: '&view=getproduct', 3756 a_a: 'wk-add',
3757 a_d: 'wk-remove', 3758 space: 'comparedata', 3759 com_json: {}, 3760 com_count: 0, 3761 com_limit: 0, 3762 init: function(){ 3763 var _ = this; 3764 this.comparepage(); 3765 3766 if(!$('.compare-js').length) return false; 3767 3768 this.selected(); 3769 $(window).on( "compareevent", function(){ 3770 var o = $('.compare-js'); 3771 o.length && o.attr('data-action', _.a_a).attr('data-tooltip', o.attr('data-add')); 3772 _.setPageButtonText(o, 'data-prpage-add'); 3773 compare.selected(); 3774 }); 3775 3776 $('body').on('click', '.compare-js', function(e){ 3777 e.preventDefault(); 3778 var $this = $(this); 3779 $this.attr('data-action') == _.a_a ? compare.setdata($this) : compare.deletedata($this); 3780 _.setItemLengthInBadge(); 3781 }) 3782 }, 3783 selectItems: function(){ 3784 this.selected(); 3785 }, 3786 comparepage: function(){ 3787 if(!$('.comparepage').length || !this.checkEmptyPage()) return false 3788 3789 $('.comparepage').removeClass('hide'); 3790 3791 var _ = this, 3792 l = $.parseJSON(localStorage[compare.space]); 3793 3794 this.com_limit = _.getjsonsize(l); 3795 3796 $.each(l, function(index, value){ 3797 _.getproduct(index, value); 3798 }); 3799 }, 3800 createcomparepage: function(l){ 3801 var _ = this, 3802 p = $('.compare-init-slider'), 3803 b = $('.compareitemhtml').find('.tt-item'); 3804 3805 this.setOptionsTable(l, b); 3806 3807 var count = Object.keys(l).length; 3808 $('.tt-col-item').attr('data-grid', count); 3809 3810 $.each(l, function (index, value) { 3811 var o = b.clone(); 3812 o.find('.tt-remove-item').attr('data-compareid', index); 3813 o.find('.tt-img').find('a').attr('href', value.url).find('img').attr('src', value.image); 3814 o.find('.tt-title').find('a').text(value.title).attr('href', value.url); 3815 3816 if(value.price < value['compare price']){ 3817 o.find('.tt-price').find('.new-price').html(value.price); 3818 o.find('.tt-price').find('.old-price').html(value['compare price']); 3819 } 3820 else{ 3821 o.find('.tt-price').find('.new-price').html(value.price).removeClass('new-price'); 3822 o.find('.tt-price').find('.old-price').remove(); 3823 } 3824 3825 if(!Boolean(value.available)){ 3826 o.find('.tt-btn-addtocart').closest("form").remove(); 3827 o.find('.tt-label-location').children().first().remove(); 3828 } 3829 3830 o.find('form').find('input').val(index); 3831 3832 $.each(value.data, function (index, value) { 3833 var o2 = o.find('[data-val="'+index+'"]'); 3834 o2.length && o2.html(value); 3835 }); 3836 3837 $.each(value.options, function (index, value) { 3838 var o2 = o.find('[data-val="'+index+'"]'); 3839 o2.length && o2.html(value); 3840 }); 3841 3842 p.append(o); 3843 }); 3844 3845 $('body').trigger('refreshCurrency'); 3846 setTimeout(function(){ 3847 $(window).trigger('resize'); 3848 ct.sliderinit(); 3849 }, 500); 3850 }, 3851 checkEmptyPage: function(){ 3852 var d = localStorage[compare.space]; 3853 if(d = d === undefined || d === "undefined"){ 3854 $('.comparepageempty').removeClass('hide'); 3855 $('.comparepage').remove(); 3856 return false; 3857 } 3858 return true; 3859 }, 3860 setOptionsTable: function(l, $obj){ 3861 var t = $('.tt-value[data-val="empty"]'); 3862 var tmp = $('.tt-col-title.tt-compare-table-js'); 3863 var tm = $('.title-item[data-val="maintable"]'); 3864 var a = []; 3865 3866 if(!tm.length) return false; 3867 3868 $.each(l, function (index, value) { 3869 $.each(value.options, function (index, value) { 3870 index != "Title" && !a.includes(index) && a.push(index); 3871 }); 3872 }); 3873 if(a.length == 0) return false; 3874 for(var i=0; i<a.length; i++){ 3875 $obj.append(t.clone().attr('data-val', a[i])) 3876 tmp.append(tm.clone().text(a[i])); 3877 } 3878 }, 3879 selected: function(){ 3880 var d = localStorage[compare.space]; 3881 if(d = d === undefined || d === "undefined") return false; 3882 3883 var _ = this, 3884 l = $.parseJSON(localStorage[compare.space]); 3885 $.each(l, function (index, value) { 3886 var o = $('[data-compareid="'+index+'"]'); 3887 o.length && o.attr('data-action', _.a_d).attr('data-tooltip', o.attr('data-remove')); 3888 _.setPageButtonText(o, 'data-prpage-rem'); 3889 }); 3890 }, 3891 setPageButtonText: function(o, attr){ 3892 if(o.hasClass('prpagebtn-js')){ 3893 var s = o.attr(attr); 3894 o.find('span').text(s); 3895 } 3896 }, 3897 getproduct: function(id, url){ 3898 var _ = this, 3899 u = url+'?variant='+id+this.search; 3900 var params = { 3901 type: "get", 3902 url: u, 3903 success: function(data) { 3904 3905 compare.com_json[id] = $.parseJSON(data); 3906 3907 if(compare.com_json[id].hasOwnProperty('url')){ 3908 compare.com_json[id]['url'] = url+'?variant='+id; 3909 } 3910 3911 compare.checkloadwnd(); 3912 }, 3913 error: function(XMLHttpRequest, textStatus) { 3914 compare.deleteitem(id); 3915 compare.checkloadwnd(); 3916 console.log('product not found'); 3917 } 3918 }; 3919 jQuery.ajax(params); 3920 }, 3921 checkloadwnd:function(){ 3922 compare.com_count += 1; 3923 if(compare.com_limit <= compare.com_count){ 3924 compare.createcomparepage(compare.com_json); 3925 } 3926 }, 3927 getjsonsize: function(value){ 3928 return Object.keys(value).length; 3929 }, 3930 setdata: function($obj){ 3931 var _ = this, 3932 d = localStorage[compare.space], 3933 da = $obj.attr('href'), 3934 value = this.getid($obj); 3935 3936 d = d === undefined || d === "undefined" ? false : d; 3937 3938 if(d){ 3939 d = $.parseJSON(d); 3940 d[value] = da; 3941 d = JSON.stringify(d); 3942 } 3943 else{ 3944 var d = '{"'+value+'": "'+da+'"}'; 3945 } 3946 3947 localStorage[compare.space] = d; 3948 3949 this.setPageButtonText($obj, 'data-prpage-rem'); 3950 $obj.attr('data-action', _.a_d).attr('data-tooltip', $obj.attr('data-remove')); 3951 $obj.is(':hover') && $obj.trigger('mouseleave').trigger('mouseenter'); 3952 }, 3953 getid: function($obj){ 3954 return $obj.attr('data-compareid'); 3955 }, 3956 deletedata: function($obj){ 3957 var value = this.getid($obj), 3958 l = localStorage[compare.space]; 3959 3960 if(l === undefined || l === "undefined"){ 3961 $obj.attr('data-action', this.a_a); 3962 return false;
3963 } 3964 l = $.parseJSON(l); 3965 3966 this.deleteitem(value); 3967 var count = compare.getjsonsize(l); 3968 if(l.hasOwnProperty(value) && $('.comparepage').length){ 3969 count -= 1; 3970 $obj.closest('.tt-item').fadeOut(function(){ 3971 ct.sliderunslick(); 3972 $('[data-compareid="'+value+'"]').each(function(){ 3973 $(this).closest('.tt-item').remove(); 3974 }); 3975 $('.tt-col-item').attr('data-grid', count); 3976 ct.sliderinit(); 3977 ct.resizeHandler(0); 3978 compare.checkEmptyPage(); 3979 }); 3980 return false; 3981 } 3982 3983 this.setPageButtonText($obj, 'data-prpage-add'); 3984 $obj.attr('data-action', this.a_a).attr('data-tooltip', $obj.attr('data-add')); 3985 $obj.is(':hover') && $obj.trigger('mouseleave').trigger('mouseenter'); 3986 }, 3987 deleteitem: function(value){ 3988 var l = $.parseJSON(localStorage[compare.space]) 3989 if(l.hasOwnProperty(value)){ 3990 var count = compare.getjsonsize(l); 3991 if(count > 1){ 3992 delete l[value]; 3993 l = JSON.stringify(l); 3994 localStorage[compare.space] = l; 3995 } 3996 else{ 3997 localStorage.removeItem(compare.space); 3998 } 3999 } 4000 }, 4001 setItemLengthInBadge: function(){ 4002 var l = localStorage[compare.space]; 4003 if(l === undefined || l === "undefined"){ 4004 $('.tt-compare').length && $('.tt-compare').find('.tt-badge').hide(); 4005 return false; 4006 } 4007 l = $.parseJSON(l); 4008 l = Object.keys(l).length; 4009 $('.tt-compare').length && $('.tt-compare').find('.tt-badge').show().text(l); 4010 } 4011} 4012$( document ).ready(function(){ 4013 compare.init(); 4014 compare.setItemLengthInBadge(); 4015 ct.init(); 4016}) 4017 4018if($('.tostuck-det-js').length){ 4019 $('body').on('showStuck hideStuck', function(e){ 4020 if(e.type == 'showStuck'){ 4021 $('.tostuck-det-js').each(function(){ 4022 var n = $(this).attr('data-stuckparent'); 4023 var m = $(this).attr('data-parent'); 4024 transfer(n, m, $(this)) 4025 }); 4026 } 4027 else{ 4028 $('.fromstuck-det-js').each(function(){ 4029 var n = $(this).attr('data-parent'); 4030 transfer(n, n, $(this)) 4031 }); 4032 } 4033 4034 function transfer(n, m, $this){ 4035 if($('.'+n).length){ 4036 var o = $this.children().first().detach(); 4037 $('.'+n).attr('data-parent', m).append(o); 4038 } 4039 } 4040 }) 4041} 4042 4043if($('.categories-btn').length){ 4044 $('body').on('click', '.categories-btn button', function(e){ 4045 e.preventDefault(); 4046 $(this).parent().toggleClass('opened').find('.tt-dropdown-menu').slideToggle(200); 4047 $('.categories-btn nav > ul > li').each(function(){ 4048 catbtnsubposition($(this)); 4049 alignicon($(this)); 4050 }); 4051 }).on('mouseenter', '.categories-btn nav > ul > li', function(){ 4052 catbtnsubposition($(this)); 4053 }); 4054 function catbtnsubposition($this){ 4055 var t = $this.position().top, 4056 p = $this.find('.dropdown-menu'); 4057 if(!p.length) return false; 4058 4059 var h = p.height(), 4060 ph = t+$this.height(); 4061 4062 var d = $this.closest('.headertype2').length ? 0 : -20; 4063 4064 if(h >= ph) 4065 p.css({top: d}); 4066 else 4067 p.css({top: t+d}); 4068 } 4069 function alignicon($this, d){ 4070 d = d || 1; 4071 if(!$this.find('svg').length) return false; 4072 var sh = $this.find('svg').height(), 4073 th = $this.find('span').height(), 4074 tp = $this.find('span').position().top-d, 4075 p = ((th-sh)/2)+tp; 4076 $this.find('svg').css({top:p}); 4077 } 4078 $( document ).ready(function(){ 4079 if ($('.catmenumob-js').length) { 4080 $('.catmenumob-js').initMM({ 4081 enable_breakpoint: true, 4082 mobile_button: true, 4083 breakpoint: 1025, 4084 menu_class: 'mobile-caterorie-menu', 4085 close_button_name: b_close, 4086 back_button_name: b_back 4087 }); 4088 }; 4089 $('.mobile-caterorie-menu #mm0 ul li').each(function(){ 4090 alignicon($(this), 2); 4091 }); 4092 $('.item-categories').each(function(){ 4093 alignicon($(this), 2); 4094 }); 4095 }) 4096} 4097if($('.icons-main-menu').length){ 4098 function alignicon($this, d){ 4099 d = d || 1; 4100 if(!$this.find('svg').length) return false; 4101 var sh = $this.find('svg').height(), 4102 th = $this.find('span').height(), 4103 tp = $this.find('span').position().top-d, 4104 p = ((th-sh)/2)+tp; 4105 $this.find('svg').css({top:p}); 4106 } 4107 $( document ).ready(function(){ 4108 if ($('.catmenumob-js').length) { 4109 $('.catmenumob-js').initMM({ 4110 enable_breakpoint: true, 4111 mobile_button: true, 4112 breakpoint: 1025, 4113 menu_class: 'mobile-caterorie-menu', 4114 close_button_name: b_close, 4115 back_button_name: b_back 4116 }); 4117 }; 4118 $('.mobile-caterorie-menu #mm0 ul li').each(function(){ 4119 alignicon($(this), 2); 4120 }); 4121 }) 4122} 4123function initStickPrLeft(){ 4124 var stickprcol = $('.stickprcol-js'), 4125 stickprcolheight = $('.stickprcolheight-js'), 4126 o = stickprcol.attr('data-o', stickprcol.offset().top); 4127 $('body').on('click', '.tt-collapse-title', function(){ 4128 setTimeout(function(){ 4129 setPosition(); 4130 }, 200); 4131 }) 4132 setTimeout(function(){ 4133 setPosition(); 4134 }, 500); 4135 $(window).resize(function(){ 4136 stickprcol.css({top: 0}); 4137 o = stickprcol.attr('data-o', stickprcol.offset().top); 4138 setTimeout(function(){ 4139 setPosition(); 4140 }, 100); 4141 }).scroll(function(){ 4142 setPosition(); 4143 }) 4144 function setPosition(){ 4145 typeof stickprcol.attr('css') !== typeof undefined && stickprcol.removeAttr('css'); 4146 var h = stickprcol.children().length == 1 ? stickprcol.children().height() : stickprcol.height(); 4147 if(h > $(window).height()) return false;
4148 if(h > stickprcolheight.height()) return false; 4149 4150 if($(window).width() < 768) return false; 4151 var m = 68, 4152 o = stickprcol.attr('data-o'), 4153 p = stickprcol.position().top, 4154 w = $(window).scrollTop(), 4155 4156 mh = stickprcolheight.height() - h - 10, 4157 4158 ow = Math.max(0, w-o+m); 4159 ow = Math.min(mh, ow); 4160 4161 stickprcol.css({top: ow}); 4162 $('.zoomContainer').length && $('.zoomContainer').css({top: ow+m*2}); 4163 } 4164} 4165 4166function onerowActiontoInit(){ 4167 if($('.tt-quantity').find('.tt-col-one').length){ 4168 $('.tt-quantity').find('a').click(function(){ 4169 $(this).hasClass('tt-col-one') ? onerowActiontoRight(true) : onerowActiontoBack(); 4170 }) 4171 } 4172 4173 $(window).resize(function(){ 4174 var b = $('.tt-product-listing').hasClass('tt-col-one'); 4175 $(window).width() < 791 ? onerowActiontoBack() : onerowActiontoRight(b); 4176 }) 4177 $('body').on('listingpageajax', function(){ 4178 if(!$('.tt-product-listing').hasClass('tt-col-one')) return false; 4179 onerowActiontoRight(true); 4180 }) 4181 if(!$('.tt-product-listing').hasClass('tt-col-one')) return false; 4182 onerowActiontoRight(true); 4183} 4184function onerowActiontoRight(isOneRow){ 4185 isOneRow = false || isOneRow; 4186 if($(window).width() < 791 || !isOneRow) return false; 4187 $('.product-parent').each(function(){ 4188 var o = $(this).find('.onerowactions'); 4189 if(o.children().length) return true; 4190 var p = $(this).find('.tt-price').attr('data-par', 'backtottprice').wrap('<div class="backtottprice"/>').detach(); 4191 $(this).find('.onerowactions').append(p); 4192 p = $(this).find('.tt-product-inside-hover').attr('data-par', 'backtorphov').wrap('<div class="backtorphov"/>').detach(); 4193 $(this).find('.onerowactions').append(p); 4194 }) 4195} 4196function onerowActiontoBack(){ 4197 $('.product-parent').each(function(){ 4198 var o = $(this).find('.onerowactions'); 4199 if(!o.children().length) return true; 4200 var p = $(this).find('.tt-price'), 4201 c = p.attr('data-par'); 4202 $(this).find('.'+c).append(p.detach()); 4203 $(this).find('.tt-price').unwrap(); 4204 4205 p = $(this).find('.tt-product-inside-hover'); 4206 c = p.attr('data-par'); 4207 $(this).find('.'+c).append(p.detach()); 4208 $(this).find('.tt-product-inside-hover').unwrap(); 4209 }) 4210} 4211 4212$(document).ready(function(){ 4213 $('.tt-col-one').length && onerowActiontoInit(); 4214 $('.stickprcol-js').length && initStickPrLeft(); 4215 4216 if($('[data-currency-selector]').length){ 4217 $("body").on('click', '[data-currency-selector] a', function(e) { 4218 e.preventDefault(); 4219 var v = $(this).parent().attr('data-country'); 4220 $(this).parents('form').find('[name="country_code"]').val(v).parents('form').submit(); 4221 }); 4222 } 4223 4224 if($('[data-language-selector]').length){ 4225 $("body").on('click', '[data-language-selector] a', function(e) { 4226 e.preventDefault(); 4227 var v = $(this).parent().attr('data-language'); 4228 $(this).parents('form').find('[name="locale_code"]').val(v).parents('form').submit(); 4229 }); 4230 } 4231}) 4232 4233$(document).ready(function(){ 4234 function forStickyHeaderMenuInCenter(){ 4235 if($('header').hasClass('headertype2') || $('header').hasClass('headertype3')) return false; 4236 var $ttstucknav = $('.tt-stuck-nav'); 4237 if(!$ttstucknav.length) return false; 4238 var $ttdesktopheader = $('.tt-desktop-header'); 4239 4240 if($ttdesktopheader.find('.tt-obj-menu.obj-aligment-right').length){ 4241 $ttstucknav.addClass('stuckmenuinright'); 4242 return false; 4243 } 4244 4245 4246 if(!$ttdesktopheader.find('.menu-in-center').length && !$ttdesktopheader.find('.tt-obj-menu.obj-aligment-center').length) return false; 4247 4248 $ttstucknav.addClass('stuckmenuincenter'); 4249 $(window).resize(forStickyHeaderMenuInCenterHandler); 4250 forStickyHeaderMenuInCenterHandler(); 4251 } 4252 function forStickyHeaderMenuInCenterHandler(){ 4253 var $ttstucknav = $('.tt-stuck-nav'); 4254 4255 if($(window).width() > 1024){ 4256 if($ttstucknav.find('.stuckiconsabsolute').length) return false; 4257 $ttstucknav.find('.tt-header-row').append('<div class="stuckiconsabsolute"></div>'); 4258 $ttstucknav.find('.tt-parent-box').detach().appendTo($ttstucknav.find('.stuckiconsabsolute')) 4259 } 4260 else{ 4261 if(!$ttstucknav.find('.stuckiconsabsolute').length) return false;
4262 $ttstucknav.find('.tt-parent-box').first().unwrap(); 4263 } 4264 } 4265 forStickyHeaderMenuInCenter(); 4266}) 4267 4268var settings = { 4269 entryPointInclude : $('#entrypoint-objects') 4270}; 4271var methods = { 4272 init: function(options){ 4273 return this.each(function(){ 4274 var objVar = { 4275 objClass : $(this).attr("class").split(' ')[0], 4276 extraPlaceDetach: options.extraPlaceDetach || false, 4277 changeСlasStyle: options.changeСlasStyle || false, 4278 entryPointInclude: options.entryPointInclude || false, 4279 createBlok: options.createBlok, 4280 }; 4281 4282 if(window.innerWidth <= 1024){ 4283 methods.detachMobile(objVar, options); 4284 }; 4285 4286 $(window).resize(function(){ 4287 if(window.innerWidth <= 1024){ 4288 methods.detachMobile(objVar, options); 4289 }; 4290 }); 4291 4292 }); 4293 }, 4294 detachMobile: function(objVar,options){ 4295 var setting = $.extend(settings, options); 4296 4297 objVar.entryPointInclude.attr("dataDetach", "true"); 4298 4299 $('header').addClass('dataDetach'); 4300 4301 if(objVar.createBlok){ 4302 var checkForExistence = objVar.entryPointInclude.find('.' + objVar.createBlok); 4303 if(!checkForExistence.length){ 4304 var obj = $("." + objVar.objClass).children().clone().get(0); 4305 if(typeof obj == 'undefined'){ 4306 obj = $("." + objVar.extraPlaceDetach).children().clone().get(0); 4307 } 4308 objVar.entryPointInclude.append("<div class='external-item "+ objVar.createBlok +"'></div>").find('.' + objVar.createBlok).append(obj); 4309 }; 4310 if(typeof objVar.changeСlasStyle != "false"){ 4311 objVar.entryPointInclude.find('.' + objVar.createBlok).find('.' + objVar.changeСlasStyle).removeClass(objVar.changeСlasStyle).attr("data-class", objVar.changeСlasStyle).removeAttr('style'); 4312 }; 4313 }; 4314 } 4315}; 4316$.fn.movingObjects = function(action){ 4317 if(methods[action]){ 4318 return methods[action].apply(this, Array.prototype.slice.call(arguments, 1)); 4319 } else if(typeof action === 'object' || !action){ 4320 return methods.init.apply(this, arguments); 4321 } else { 4322 console.info('Action ' +action+ 'not found this plugin'); 4323 return this; 4324 } 4325}; 4326var $header = $('header'); 4327if($header.find('.tt-mobile-header-inline').length){ 4328 $header.find('.tt-desctop-parent-account').movingObjects({ 4329 createBlok:'my-account', 4330 extraPlaceDetach: 'tt-stuck-parent-account', 4331 changeСlasStyle: 'tt-dropdown-menu', 4332 entryPointInclude: $('#entrypoint-objects'), 4333 }); 4334 $header.find('.tt-desctop-parent-multi').movingObjects({ 4335 createBlok:'my-multi', 4336 extraPlaceDetach: 'tt-stuck-parent-multi', 4337 changeСlasStyle: 'tt-dropdown-menu', 4338 entryPointInclude: $('#entrypoint-objects'), 4339 }); 4340}; 4341 4342 4343 4344 4345 4346 4347 4348 4349(function ($) { 4350 //Init Menu02 4351 var initMeny02 = $('#js-init-menu02'); 4352 if (initMeny02.length){ 4353 menu02(); 4354 }; 4355 function menu02(){ 4356 $body.on('click', '#js-init-menu02 .tt-dropdown-toggle', function(e){ 4357 openPopup(); 4358 //definitionLayout(); 4359 initMultilevelList(); 4360 return false; 4361 }); 4362 $body.on('click', '#js-init-menu02 .tt-close-modal', function(e){ 4363 closePopup(); 4364 return false; 4365 }); 4366 function closePopup(){ 4367 $('#js-init-menu02').find('.tt-close-modal').fadeOut(190); 4368 $('#js-init-menu02').find('.tt-dropdown-menu').first().fadeOut(200, function(){ 4369 $('#js-init-menu02').find('.tt-dropdown-menu').first().removeAttr("style"); 4370 $('#js-init-menu02 .tt-dropdown-menu').perfectScrollbar('destroy'); 4371 var top = parseInt($body.css("top").replace("px", ""), 10) * -1; 4372 $('#js-init-menu02').removeClass('active').find('.tt-close-modal').delay(0).fadeOut(0).removeAttr("style"); 4373 $body.removeAttr("style").removeClass('no-scroll notdelete').scrollTop(top); 4374 $html.removeAttr("style").scrollTop(top); 4375 onSound(); 4376 }) 4377 return false; 4378 }; 4379 function openPopup(){ 4380 4381 var ttScrollValue = $('body').scrollTop() || $('html').scrollTop(); 4382 $body.css("top", - ttScrollValue); 4383 4384 var logoOb = $('#js-init-menu02 .tt-modal-header .col-logo'), 4385 logoObjTop = logoOb.length ? logoOb.position().top : 0,
4386 logoObjHeight = logoOb.length ? logoOb.innerHeight() / 2 : 0, 4387 btnCloseHeight = $('#js-init-menu02 .tt-close-modal').innerHeight() / 2, 4388 btnCloseOffset = parseInt(logoObjTop + logoObjHeight - btnCloseHeight, 10); 4389 4390 4391 $('#js-init-menu02').toggleClass('active').find('.tt-close-modal').css("top", ttScrollValue).css("marginTop", btnCloseOffset).css("display", "flex").hide().delay(55).fadeIn(150); 4392 4393 4394 $body.toggleClass('no-scroll notdelete'); 4395 $('#js-init-menu02 .tt-dropdown-menu').perfectScrollbar(); 4396 offSound(); 4397 }; 4398 function offSound(){ 4399 Array.prototype.slice.call(document.querySelectorAll('video')).forEach(function(audio) { 4400 audio.muted = true; 4401 }); 4402 }; 4403 function onSound(){ 4404 Array.prototype.slice.call(document.querySelectorAll('video')).forEach(function(audio) { 4405 audio.muted = false; 4406 }); 4407 }; 4408 function definitionLayout(){ 4409 if($('body').css("direction") == 'rtl'){ 4410 $('body').addClass('rtl'); 4411 }; 4412 $('#js-init-menu02 .definitionLayout').each(function(){ 4413 var liQuantity = $(this).find(' > li').length; 4414 if(liQuantity <= 10){ 4415 $(this).addClass('ul_sm'); 4416 } else if (liQuantity >= 11 && liQuantity <= 20){ 4417 $(this).addClass('ul_md').liColl({ 4418 c_unit: '%', 4419 n_coll: 2 4420 }); 4421 } else if (liQuantity >= 21){ 4422 $(this).addClass('ul_lg').liColl({ 4423 c_unit: '%', 4424 n_coll: 3 4425 }); 4426 }; 4427 }); 4428 }; 4429 function initMultilevelList(){ 4430 $('#js-init-menu02').find('.tt-multilev-list li').on("mouseenter", function(){ 4431 $(this).addClass('active').closest('.nav-multilevel').addClass('active').closest('.tt-dropdown-menu').addClass('dropdown-menu-active'); 4432 var $ul = $(this).find('ul:first').addClass('active'); 4433 if ($ul.length){ 4434 var widthDropdownArrow01 = 20, 4435 widthDropdownArrow02 = 17, 4436 indentDropdown = 20; 4437 if(!$ul.hasClass('definitionLayout') && !$('body').hasClass('rtl')){ 4438 $(this).find('ul:first').css({ 4439 marginLeft: -widthDropdownArrow01 4440 }); 4441 }; 4442 4443 var offsetLeftDropdown = parseInt($(this).find('> a').innerWidth(), 10) + widthDropdownArrow02 + indentDropdown; 4444 4445 if(!$('html').hasClass('rtlstyle')){ 4446 $(this).find('> ul').css({ 4447 left: offsetLeftDropdown 4448 }); 4449 } else{ 4450 $(this).find('> ul').css({ 4451 right: offsetLeftDropdown 4452 }); 4453 } 4454 4455 4456 4457 //check horizontal position 4458 var windW = window.innerWidth, 4459 ulW = parseInt($ul.css('width'), 10) + 20, 4460 thisR = this.getBoundingClientRect().right, 4461 thisL = this.getBoundingClientRect().left; 4462 4463 4464 if (windW - thisR < ulW){ 4465 $ul.addClass('left-popup'); 4466 } else{ 4467 $ul.removeClass('left-popup'); 4468 }; 4469 //check vertical position 4470 var winH = window.innerHeight, 4471 ulH = parseInt($ul.css('height'), 10) + 23, 4472 thisT = this.getBoundingClientRect().top, 4473 thisB = this.getBoundingClientRect().bottom; 4474 4475 var objHeight = ulH + thisT, 4476 checkEror = parseInt((objHeight - winH - 20), 10), 4477 checkEror02 = parseInt($ul.css('height') - 20, 10), 4478 linkHeight = parseInt($(this).find('> a').css('height'), 10), 4479 linkHeight = (linkHeight / 2) * -1; 4480 4481 4482 4483 if (winH < objHeight && winH > ulH){ 4484 var checkEror = checkEror * -1 4485 if (checkEror < linkHeight){ 4486 $ul.css({ 4487 top: checkEror 4488 }); 4489 } else { 4490 $ul.css({ 4491 top: linkHeight 4492 }); 4493 } 4494 } else if(winH < objHeight && winH < ulH + 40){ 4495 var checkEror = checkEror * -1 4496 $ul.css({ 4497 top: checkEror 4498 }); 4499 }; 4500 4501 }; 4502 $ul.stop(true, true).addClass('active').delay(200).fadeIn(150); 4503 }).on('mouseleave', function(){ 4504 $(this).find('ul:first').stop(true, true).removeClass('active').fadeOut(50); 4505 $(this).removeClass('active').closest('.nav-multilevel').removeClass('active').closest('.tt-dropdown-menu').removeClass('dropdown-menu-active'); 4506 $(this).find('> ul').removeAttr("style"); 4507 }); 4508 }; 4509 }; 4510})(jQuery); 4511 4512$('[data-linkto]').length && $('[data-linkto]').on('click', function(e){e.preventDefault(); window.location.href = $(this).attr('data-linkto');}); 4513 4514$('.btnanimation').length && $('body').on('mouseenter','.btnanimation',function(e){ 4515 if($(window).width() < 1025) return false;
4516 var $wr = $(this).find('.tt-description-wrapper'); 4517 var $btns = $(this).find('.tt-description-wrapper-main .custom-buttons'); 4518 if(!$btns.length) return false; 4519 var wrh = $wr.height(); 4520 var wrp = $(window).width() < 1600 ? Number($btns.attr("data-offsetmedium")): Number($btns.attr("data-offset")); 4521 var btnp = wrh+wrp; 4522 4523 if($(this).hasClass('btnanimationcenter')){ 4524 wrp += $(this).find('.custom-buttons').height(); 4525 wrp = Math.round(wrp/2); 4526 $btns.stop().animate({top:btnp, opacity: 1},300); 4527 $wr.stop().animate({top:-wrp},300); 4528 } 4529 else{ 4530 wrp += Math.round($(this).find('.custom-buttons').height()); 4531 $wr.stop().animate({top:-wrp},300); 4532 $btns.stop().animate({opacity: 1},600); 4533 } 4534 4535}).on('mouseleave','.btnanimation',function(e){ 4536 if($(window).width() < 1025) return false; 4537 var $wr = $(this).find('.tt-description-wrapper'); 4538 var $btns = $(this).find('.tt-description-wrapper-main .custom-buttons'); 4539 if(!$btns.length) return false; 4540 4541 var wrh = $wr.innerHeight(); 4542 if($(this).hasClass('btnanimationcenter')){ 4543 var btnp = wrh-($(window).width() < 1600 ? Number($btns.attr("data-offsetmedium")): Number($btns.attr("data-offset")))+10; 4544 $btns.stop().animate({top:btnp, opacity: 0},200); 4545 $wr.stop().animate({top:0},300); 4546 } 4547 else{ 4548 $wr.stop().animate({top:0},500); 4549 $btns.stop().animate({opacity: 0},200); 4550 } 4551}); 4552 4553if($('[data-customtabsdelay]').length){ 4554 $('[data-customtabsdelay]').each(function(){ 4555 var $this = $(this); 4556 var interval = _setInterval(); 4557 function intervalHandle(param1){ 4558 var ch = param1.children().length-1, 4559 ind = param1.find('.active').parent().index(); 4560 ind += 1; 4561 if(ind > ch) ind = 0; 4562 param1.children().eq(ind).children().trigger('click'); 4563 } 4564 4565 $this.closest('.tabs-box').on('mouseenter', function(){ 4566 clearInterval(interval); 4567 }).on('mouseleave', function(){ 4568 interval = _setInterval(); 4569 }) 4570 $this.find('a').on('mousedown', function(){ 4571 clearInterval(interval); 4572 }) 4573 4574 function _setInterval(){ 4575 return setInterval(intervalHandle, Number($this.attr('data-customtabsdelay')), $this); 4576 } 4577 }) 4578}
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.