1jQuery.noConflict(); 2(function( $ ) { 3 $(function() { 4 5(function () { 6 7 $(function () { 8 $(".shop_table .order-total").removeClass("order-total"); 9 //$('.sorting').click(function (e) { 10 // 11 // var _isHeader = $(e.target).parent('li').html(); 12 // if (_isHeader !== undefined) 13 // return false; 14 // 15 // $('.sorting').toggleClass('active'); 16 // 17 // return false; 18 // 19 //}); 20 // Smooth Scrolling 21 22 $(function () { 23 24 $.each($('#mobile-menu'), function () { 25 new MobileMenu($(this)); 26 }); 27 28 $.each($('#main-menu'), function () { 29 new MainMenu($(this)); 30 }); 31 32 $.each($('.accordion'), function () { 33 new Accordion($(this)); 34 }); 35 36 $.each($('.comparison-table'), function () { 37 new ComprasionSwiper($(this)); 38 }); 39 40 $.each($('#theme-list'), function () { 41 new Sorting($(this)); 42 }); 43 44 $.each($('.promo-view'), function () { 45 new Promo($(this)); 46 }); 47 48 $.each($('.column-mobile'), function () { 49 new Showcase($(this)); 50 }); 51 52 new sliderManager(); 53 54 }); 55 56 function filterPath(string) { 57 return string 58 .replace(/^\//, '') 59 .replace(/(index|default).[a-zA-Z]{3,4}$/, '') 60 .replace(/\/$/, ''); 61 } 62 var locationPath = filterPath(location.pathname); 63 var scrollElem = scrollableElement('html', 'body', 'document', 'window'); 64 65 $('a[href*=#]').each(function () { 66 var thisPath = filterPath(this.pathname) || locationPath; 67 if (locationPath == thisPath 68 && (location.hostname == this.hostname || !this.hostname) 69 && this.hash.replace(/#/, '')) { 70 var $target = $(this.hash), target = this.hash; 71 if (target) { 72 //console.log('Target: ' + target + ' offset: ' + targetOffset); 73 $(this).click(function (event) { 74 if ($target.offset()) { 75 var targetOffset = $target.offset().top; 76 event.preventDefault(); 77 $(scrollElem).animate({ 78 scrollTop: targetOffset 79 }, 1800, function () { 80 //console.log($(scrollElem).scrollTop()); 81 location.hash = target; 82 }); 83 } 84 }); 85 } 86 } 87 }); 88 89 // use the first element that is "scrollable" 90 function scrollableElement(els) { 91 for (var i = 0, argLength = arguments.length; i < argLength; i++) { 92 var el = arguments[i], 93 $scrollElement = $(el); 94 if ($scrollElement.scrollTop() > 0) { 95 return el; 96 } else { 97 $scrollElement.scrollTop(1); 98 var isScrollable = $scrollElement.scrollTop() > 0; 99 //console.log(el + ': ' + $scrollElement.scrollTop()); 100 $scrollElement.scrollTop(0); 101 if (isScrollable) { 102 return el; 103 } 104 } 105 } 106 return 'body'; 107 } 108 109 //$(function () { 110 // if ($('.themes').length > 0) { 111 // var $container = $('.themes'); 112 // // initialize Isotope 113 // $container.isotope({ 114 // itemSelector: '.column', 115 // // options... 116 // resizable: true // disable normal resizing 117 // }); 118 // } 119 // // filter items when filter link is clicked 120 // $('.sorting a').click(function () { 121 // var selector = $(this).attr('data-filter'); 122 // $container.isotope({ 123 // filter: selector 124 // }); 125 // return false; 126 // }); 127 //}); 128 129 $('.switcher-fix').each(function () { 130 131 $(window).on("scroll", function () { 132 var windowsScroll = $(window).scrollTop(), 133 scrollTop = $('.our-features').offset().top; 134 135 if (windowsScroll > scrollTop) { 136 $('.switcher-fix').addClass('switcher-fix_show'); 137 } else { 138 $('.switcher-fix').removeClass('switcher-fix_show'); 139 } 140 }); 141 142 }); 143 144 $('.facebook-chat-handler').on('click', function (e) { 145 $('.facebook-chat .facebook-chat-container').toggle('slow', function () { 146 if ($('.facebook-chat-container').is(':visible')) { 147 $('.facebook-chat-handler').html('Close Chat <span>X</span>'); 148 } else { 149 $('.facebook-chat-handler').html('Questions?'); 150 } 151 }); 152 return false; 153 }); 154 155 $('.video_container').each(function () { 156 new NeedEvent($(this)); 157 }); 158 159 // workaround for checkout checkboxes 160 $('.checkout .form-row input[type=checkbox]').on('change', function (e) { 161 khore_refresh_checkout_checkbox(this); 162 }); 163 164 $('.checkout .form-row input[type=checkbox]').each(function (i, el) { 165 khore_refresh_checkout_checkbox(el); 166 }); 167 168 function khore_refresh_checkout_checkbox(checkbox) { 169 if ($(checkbox).is(':checked')) { 170 $(checkbox).closest('.form-row').addClass('checked'); 171 } else { 172 $(checkbox).closest('.form-row').removeClass('checked'); 173 } 174 } 175 176 if (!$('#showcase-anchor').length) { 177 $('a[href="#showcase-anchor"]').attr('href', 'http://www.showthemes.com/#showcase-anchor'); 178 } 179 180 $('.cart .coupon__title').on('click', function (e) { 181 e.preventDefault(); 182 var couponContainer = $(this).next('.coupon'); 183 if (couponContainer.is(':visible')) { 184 couponContainer.slideUp('slow'); 185 } else { 186 couponContainer.slideDown('slow'); 187 } 188 }); 189 190 $('.slider-showcase li a').hover(function () { 191 var title = $(this).attr('title'); 192 $(this).data('tipText', title).removeAttr('title'); 193 $('<p class="tooltip"></p>') 194 .text(title) 195 .appendTo('body') 196 .fadeIn('slow'); 197 }, function () { 198 // Hover out code 199 $(this).attr('title', $(this).data('tipText')); 200 $('.tooltip').remove(); 201 }).mousemove(function (e) { 202 var mousex = e.pageX + 20; //Get X coordinates 203 var mousey = e.pageY + 10; //Get Y coordinates 204 $('.tooltip').css({top: mousey, left: mousex}); 205 }); 206 207 }); 208 209 var NeedEvent = function (obj) { 210 211 //private properties 212 var _self = this, 213 _obj = obj, 214 _btn = obj.find('.play'), 215 _frame = _btn.data('video'), 216 _opened = false, 217 _popup = $('<div class="need-event__popup"/>').append('<a class="popup_close">Close</a>'); 218 219 //private methods 220 var addEvents = function () { 221 _btn.on({ 222 click: function () { 223 _self.showPopup(); 224 225 return false;
226 } 227 }); 228 $('.popup_close').on({ 229 click: function () { 230 if (_opened) { 231 _self.closePopup(); 232 } 233 } 234 }); 235 }, 236 appendPopup = function () { 237 _obj.wrap = $('<div class="need-event__wrap"/>'); 238 _obj.wrap.append(_popup); 239 _obj.append(_obj.wrap); 240 241 }, 242 init = function () { 243 appendPopup(); 244 addEvents(); 245 }; 246 247 _self.closePopup = function () { 248 _popup.parent().removeClass('active'); 249 setTimeout(function () { 250 _popup.find('iframe').remove(); 251 _opened = false; 252 }, 500); 253 }; 254 _self.showPopup = function () { 255 _popup.append(_frame); 256 _popup.parent().addClass('active'); 257 _opened = true; 258 }; 259 init(); 260 }; 261 262 var sliderManager = function (obj) { 263 264 //private properties 265 var _self = this, 266 _obj = obj, 267 _swiperHappy = null, 268 swiper = null; 269 270 //private methods 271 var addEvents = function () { 272 $(window).on({ 273 resize: function (e) { 274 updateTwitter(); 275 updateIscroll(); 276 updateHappy(); 277 sliderHeight(); 278 } 279 }); 280 }, 281 createIscroll = function () { 282 if ($('#showcase-slider').length && $(window).width() > 768) { 283 284 $("#scroller").mCustomScrollbar({ 285 axis: "x", // horizontal scrollbar 286 setHeight: '239px', 287 scrollInertia: 150, 288 autoHideScrollbar: false, 289 autoExpandScrollbar: false, 290 alwaysShowScrollbar: 2 291 }); 292 293 } 294 }, 295 updateIscroll = function () { 296 if ($('#showcase-slider').length && $(window).width() > 768) { 297 $("#scroller").mCustomScrollbar({ 298 axis: "x", // horizontal scrollbar 299 setHeight: '239px', 300 scrollInertia: 150, 301 autoHideScrollbar: false, 302 autoExpandScrollbar: false, 303 alwaysShowScrollbar: 2 304 }); 305 306 } else { 307 $("#scroller").mCustomScrollbar('destroy'); 308 } 309 }, 310 createTwitter = function () { 311 var slidesPerView = 1; 312 if ($('.slider-tweets').length && $(window).width() > 768) { 313 slidesPerView = 3; 314 } 315 swiper = new Swiper('.slider-tweets', { 316 nextButton: '.slider__btn_next', 317 prevButton: '.slider__btn_prev', 318 slidesPerView: slidesPerView, 319 centeredSlides: false, 320 paginationClickable: false, 321 spaceBetween: 30, 322 speed: 600 323 }); 324 }, 325 sliderHeight = function () { 326 var _height = $('.happy-slide__text-wrap').height(); 327 $('.happy-slide_content').height(_height); 328 }, 329 createHappy = function () { 330 var perView = 5; 331 if ($(window).width() < 1024 && $(window).width() > 768) { 332 perView = 3; 333 } else if ($(window).width() <= 768) { 334 perView = 1; 335 } 336 _swiperHappy = new Swiper('.hcustomers__happy-slide', { 337 nextButton: '.slider__btn_happy_next', 338 prevButton: '.slider__btn_happy_prev', 339 loop: true, 340 slidesPerView: perView, 341 loopedSlides: 10, 342 centeredSlides: true, 343 watchSlidesVisibility: true, 344 paginationClickable: true, 345 speed: 400 346 }); 347 348 if (_swiperHappy.on) { 349 _swiperHappy.on('slideChangeEnd', function (e) { 350 _swiperHappy.onResize(); 351 _swiperHappy.update(); 352 $('.happy-slide__text-wrap.active').removeClass('active'); 353 354 var curIndex = $('.swiper-slide-active').data('swiper-slide-index'); 355 $('.happy-slide__text-wrap').each(function (i, el) { 356 if ($(el).data('index') == curIndex) { 357 $(el).addClass('active'); 358 } 359 }) 360 }); 361 } 362 }, 363 updateHappy = function () { 364 if ($(window).width() > 1024) { 365 if (_swiperHappy.params.slidesPerView != 5) { 366 _swiperHappy.params.slidesPerView = 5; 367 } 368 } else if ($(window).width() <= 1024 && $(window).width() > 768) { 369 if (_swiperHappy.params.slidesPerView != 3) { 370 _swiperHappy.params.slidesPerView = 3; 371 } 372 } else { 373 if (_swiperHappy.params.slidesPerView != 1) { 374 _swiperHappy.params.slidesPerView = 1; 375 } 376 } 377 378 }, 379 updateTwitter = function () { 380 if ($(window).width() <= 768) { 381 if (swiper.params.slidesPerView != 1) { 382 swiper.params.slidesPerView = 1; 383 } 384 } else { 385 if (swiper.params.slidesPerView != 3) { 386 swiper.params.slidesPerView = 3; 387 } 388 } 389 }, 390 init = function () { 391 addEvents(); 392 createIscroll(); 393 createTwitter(); 394 createHappy(); 395 sliderHeight(); 396 }; 397 398 init(); 399 }; 400 401 var Accordion = function (obj) { 402 403 //private properties 404 var _self = this, 405 _obj = obj, 406 _accordionItem = _obj.find('.accordion__item'), 407 _accordionCaption = _accordionItem.find('.accordion__caption'), 408 _accordionContent = _accordionItem.find('.accordion__content'), 409 _window = $(window), 410 _pos = 0, 411 _clickFlag = true; 412 413 //private methods 414 var _closeAccordion = function (curElem, nextElem) { 415 416 _accordionCaption.removeClass('similar'); 417 curElem.removeClass('active'); 418 curElem.css({ 419 'margin-bottom': '' 420 }); 421 nextElem.removeClass('visible'); 422 423 }, 424 _onEvents = function () { 425 426 _window.on({ 427 resize: function () { 428 429 if (_accordionCaption.filter('.active').length) { 430 431 _setPosItems(_accordionCaption.filter('.active'), _accordionCaption.filter('.active').next()); 432 433 } 434 435 } 436 }); 437 438 _accordionCaption.on({ 439 click: function () { 440 441 var curItem = $(this), 442 nextElem = curItem.next(); 443 444 if (!(curItem.hasClass('active'))) { 445 446 if (_clickFlag) { 447 448 _openAccordion(curItem, nextElem); 449 450 } 451 452 } else { 453 454 _closeAccordion(curItem, nextElem); 455 456 } 457 458 return false;
459 460 } 461 462 }); 463 464 }, 465 _openAccordion = function (curElem, nextElem) { 466 467 _clickFlag = false; 468 _accordionCaption.removeClass('active'); 469 _accordionCaption.css({ 470 'margin-bottom': '' 471 }); 472 _accordionContent.removeClass('visible similar'); 473 474 curElem.addClass('active'); 475 476 _setPosItems(curElem, nextElem); 477 nextElem.addClass('visible'); 478 479 setTimeout(function () { 480 481 _clickFlag = true; 482 483 }, 300); 484 485 }, 486 _init = function () { 487 488 _obj[0].obj = _self; 489 _onEvents(); 490 491 }, 492 _setPosItems = function (caption, elem) { 493 494 caption.css({ 495 'margin-bottom': elem.innerHeight() + 20 496 }); 497 498 setTimeout(function () { 499 500 var elemPos = caption.position().top, 501 elemHeight = caption.outerHeight(); 502 503 _pos = elemPos + elemHeight; 504 505 elem.css({ 506 'top': _pos 507 }); 508 509 //_accordionCaption.each( function() { 510 // 511 // if( $(this).position().top == elemPos ) { 512 // 513 // $(this).addClass( 'similar' ); 514 // 515 // } else { 516 // 517 // $(this).removeClass( 'similar' ); 518 // 519 // } 520 // 521 //} ); 522 523 }, 310); 524 525 }; 526 527 _init(); 528 }; 529 530 var MainMenu = function (obj) { 531 532 //private properties 533 var _self = this, 534 _obj = obj, 535 _arrowBtn = _obj.find('.menu__arrow'), 536 _window = $(window); 537 538 //private methods 539 var _onEvents = function () { 540 541 _arrowBtn.parent('li').on({ 542 click: function (event) { 543 544 var curItem = $(this).find('.menu__arrow'), 545 subMenu = curItem.next(); 546 547 if (curItem.hasClass('opened')) { 548 549 curItem.removeClass('opened'); 550 subMenu.removeClass('visible'); 551 552 } else { 553 554 curItem.addClass('opened'); 555 subMenu.addClass('visible'); 556 } 557 558 559 if ($(event.target).hasClass('no-scroll')) { 560 return true; 561 } 562 else if ($(event.target).attr('href') && $(event.target).attr('href').indexOf('#') === -1) { 563 return true; 564 } else { 565 return false; 566 } 567 568 } 569 570 }); 571 572 _obj.on( 573 "click", 574 function (event) { 575 event = event || window.event; 576 577 if (event.stopPropagation) { 578 event.stopPropagation(); 579 } else { 580 event.cancelBubble = true; 581 } 582 } 583 ); 584 585 $(document).on( 586 "click", 587 "body", 588 function () { 589 590 if (_arrowBtn.hasClass('opened')) { 591 _arrowBtn.removeClass('opened'); 592 _arrowBtn.next().removeClass('visible'); 593 } 594 } 595 ); 596 597 }, 598 _init = function () { 599 600 _obj[0].obj = _self; 601 _onEvents(); 602 603 }; 604 605 _init(); 606 }; 607 608 var Sorting = function (obj) { 609 610 //private properties 611 var _self = this, 612 _obj = obj, 613 _items = _obj.find('.sorting-wrap__item'), 614 _list = _items.find('.sorting'), 615 _labels = _obj.find('.sorting-labels'), 616 _window = $(window), 617 _themesBlock = _obj.find('.themes'), 618 _hiddenInput = _obj.find('.sorts-name'), 619 _request = new XMLHttpRequest(), 620 _preloader = $('<div class="theme-list__preloader"></div>'), 621 _data = {}, 622 _arr = []; 623 624 //private methods 625 var _addContent = function (msg) { 626 627 $.each(msg.items, function () { 628 629 630 631 if (!(this.new == undefined)) { 632 var newBlock = $('<div class="column column1 hidden">\ 633 <img src="' + this.url1 + '" alt="Khore">\ 634 <a class="thumbnail" href="' + this.href1 + '">\ 635 <img src="' + this.url2 + '" alt="Khore">\ 636 <span class="new">' + this.new + '</span>\ 637 <div>\ 638 <span class="btn btn_grey" href="' + this.permLink + '">FEATURES</span>\ 639 </div>\ 640 </a>\ 641 <div class="content">\ 642 <div>\ 643 <h3>\ 644 <a title="' + this.title + '" href="' + this.href2 + '">' + this.title + '</a>\ 645 </h3>\ 646 <a href="' + this.href3 + '" class="btn btn_red">DEMO</a>\ 647 </div>\ 648 ' + this.text + '\ 649 </div>\ 650 </div>'); 651 652 } else { 653 var newBlock = $('<div class="column column1 hidden">\ 654 <img src="' + this.url1 + '" alt="Khore">\ 655 <a class="thumbnail" href="' + this.href1 + '">\ 656 <img src="' + this.url2 + '" alt="Khore">\ 657 <div>\
658 <span class="btn btn_grey" href="' + this.permLink + '">FEATURES</span>\ 659 </div>\ 660 </a>\ 661 <div class="content">\ 662 <div>\ 663 <h3>\ 664 <a title="' + this.title + '" href="' + this.href2 + '">' + this.title + '</a>\ 665 </h3>\ 666 <a href="' + this.href3 + '" class="btn btn_red">DEMO</a>\ 667 </div>\ 668 ' + this.text + '\ 669 </div>\ 670 </div>'); 671 } 672 673 _themesBlock.append(newBlock); 674 675 }); 676 677 var newItems = _themesBlock.find('.hidden'); 678 679 setTimeout(function () { 680 681 newItems.each(function (i) { 682 _showNewItems($(this), i); 683 }); 684 685 }, 50); 686 687 688 689 }, 690 _createLabels = function (title, taxonomy) { 691 692 var label = $('<div class="sorting-label" title="' + title + '" data-taxonomy="' + taxonomy + '">' + 693 '<a href="#" class="sorting-label__close"></a>' + 694 '<span>' + title + '</span>' + 695 '</div>'); 696 697 _labels.append(label); 698 699 //_data[label.attr('title')] = label.attr('title'); 700 if (!_data[label.attr('data-taxonomy')]) { 701 _data[label.attr('data-taxonomy')] = new Array(); 702 } 703 _data[label.attr('data-taxonomy')].push(label.attr('title')); 704 705 _writeInInput(); 706 707 }, 708 _onEvents = function () { 709 710 _list.find('label').on({ 711 click: function () { 712 var curItem = $(this), 713 title = curItem.attr('title'); 714 taxonomy = curItem.attr('data-taxonomy'); 715 716 if ($('.sorting-label[title="' + title + '"]').length) { 717 _removeLabels(title, taxonomy); 718 } else { 719 _createLabels(title, taxonomy); 720 } 721 722 if (_window.width() >= 1024) { 723 724 _items.removeClass('visible'); 725 726 } else { 727 728 _items.removeClass('visible'); 729 _items.find('.sorting').slideUp(); 730 731 } 732 733 } 734 }); 735 736 _items.on({ 737 click: function () { 738 var curItem = $(this); 739 740 if (_window.width() >= 1024) { 741 742 if (curItem.hasClass('visible')) { 743 curItem.removeClass('visible'); 744 } else { 745 _items.removeClass('visible'); 746 curItem.addClass('visible'); 747 } 748 749 750 } else { 751 if (curItem.hasClass('visible')) { 752 curItem.removeClass('visible'); 753 curItem.find('.sorting').slideUp(); 754 } else { 755 _items.removeClass('visible'); 756 curItem.addClass('visible'); 757 758 _items.find('.sorting').slideUp(); 759 curItem.find('.sorting').slideDown(); 760 } 761 762 } 763 764 } 765 }); 766 767 $(document).on( 768 "click", 769 ".sorting-label__close", 770 function () { 771 var curItem = $(this), 772 parent = curItem.parent(), 773 parentTitle = parent.attr('title'); 774 775 //delete _data[parent.attr('title')]; 776 _data[parent.attr('data-taxonomy')].pop(parent.attr('title')); 777 778 _writeInInput(); 779 780 parent.remove(); 781 _items.find('.nice-checkbox label[title="' + parentTitle + '"]').prev('input[type=checkbox]').prop('checked', false); 782 783 return false; 784 } 785 ); 786 }, 787 _init = function () { 788 789 _obj[0].obj = _self; 790 _onEvents(); 791 792 }, 793 _removeLabels = function (title, taxonomy) { 794 795 //delete _data[title]; 796 _data[taxonomy].pop(title); 797 _writeInInput(); 798 799 $('.sorting-label[title="' + title + '"]').remove(); 800 801 }, 802 _requestContent = function () { 803 804 _request.abort(); 805 806 _request = $.ajax({ 807 url: _obj.attr('data-action'), 808 data: { 809 action: 'filter_themes', 810 input: _hiddenInput.val() 811 }, 812 dataType: 'json', 813 type: 'post', 814 success: function (msg) { 815 816 817 setTimeout(function () { 818 819 _themesBlock.html(''); 820 _addContent(msg); 821 _preloader.removeClass('visible'); 822 823 setTimeout(function () { 824 _preloader.remove(); 825 826 }, 300); 827 828 829 830 }, 300); 831 832 833 }, 834 error: function (XMLHttpRequest) { 835 if (XMLHttpRequest.statusText != "abort") { 836 alert("ERROR!!!"); 837 } 838 } 839 }); 840 841 }, 842 _showNewItems = function (item, index) { 843 844 setTimeout(function () { 845 item.removeClass('hidden'); 846 }, index * 50); 847 848 }, 849 _writeInInput = function () { 850 851 /*_arr = []; 852 853 for (var key in _data) { 854 855 var item = _data[ key ]; 856 _arr.push(item); 857 } 858 859 _hiddenInput.val(_arr);*/ 860 861 _hiddenInput.val(JSON.stringify(_data)); 862 863 _obj.append(_preloader); 864 setTimeout(function () { 865 866 _preloader.addClass('visible'); 867 868 }, 20); 869 870 _themesBlock.find('.column').addClass('hidden'); 871 872 _requestContent(); 873 874 }; 875 876 _init(); 877 }; 878 879 var ComprasionSwiper = function (obj) { 880 881 //private properties 882 var _self = this, 883 _obj = obj, 884 _window = $(window), 885 _swiperMain, 886 _swiperHeaders, 887 _headers = _obj.find('.comparison-table__swiper .pricing-header'), 888 _swiperContainerMain = _obj.find('.comparison-table__swiper'), 889 _swiperContainerHeaders = _obj.find('.comparison-table__headers .swiper-container'), 890 _clickFlag = true; 891 892 //private methods 893 var _onEvents = function () { 894 895 _window.on({ 896 resize: function () { 897 898 _updateSwiperMain(); 899 900 }, 901 scroll: function () { 902 903 if (_window.width() <= 768) { 904 905 if (_window.scrollTop() > _headers.height() + _headers.offset().top && _window.scrollTop() < _headers.offset().top + _obj.outerHeight() - 400) { 906 _swiperContainerHeaders.parent().addClass('visible'); 907 } 908 else { 909 _swiperContainerHeaders.parent().removeClass('visible'); 910 } 911 912 } 913 914 if (_obj.hasClass('comparison-table_2')) { 915 if (_window.scrollTop() > _headers.height() + _headers.offset().top && _window.scrollTop() < _headers.offset().top + _obj.outerHeight() - 400) { 916 _swiperContainerHeaders.parent().addClass('visible'); 917 } 918 else { 919 _swiperContainerHeaders.parent().removeClass('visible'); 920 } 921 } 922 923 924 }, 925 load: function () { 926 927 setTimeout(function () { 928 929 _updateSwiperMain(); 930 931 }, 500); 932 933 if (_window.width() <= 768) { 934 935 if (_window.scrollTop() > _headers.height() + _headers.offset().top) { 936 _swiperContainerHeaders.parent().addClass('visible'); 937 } 938 else { 939 _swiperContainerHeaders.parent().removeClass('visible'); 940 } 941 942 } 943 944 if (_obj.hasClass('comparison-table_2')) { 945 if (_window.scrollTop() > _headers.height() + _headers.offset().top) { 946 _swiperContainerHeaders.parent().addClass('visible'); 947 } 948 else { 949 _swiperContainerHeaders.parent().removeClass('visible'); 950 } 951 } 952 953 954 } 955 }); 956 957 }, 958 _init = function () { 959 960 _obj[0].obj = _self; 961 _onEvents(); 962 _initSwiperMain(); 963 964 //if( _window.width() < 1024 ) { 965 _initSwiperHeders(); 966 //} 967 968 }, 969 _initSwiperMain = function () { 970 971 972 _swiperMain = new Swiper(_swiperContainerMain, {
973 slidesPerView: 7, 974 nextButton: _swiperContainerMain.find('.swiper-button-next')[0], 975 prevButton: _swiperContainerMain.find('.swiper-button-prev')[0], 976 breakpoints: { 977 1024: { 978 slidesPerView: 1 979 } 980 }, 981 onSlideChangeStart: function (swiper) { 982 var activeIndex = swiper.activeIndex; 983 984 _swiperHeaders.slideTo(activeIndex, 500, false); 985 } 986 }); 987 988 }, 989 _initSwiperHeders = function () { 990 991 _swiperHeaders = new Swiper(_swiperContainerHeaders, { 992 slidesPerView: 7, 993 nextButton: _swiperContainerHeaders.find('.swiper-button-next')[0], 994 prevButton: _swiperContainerHeaders.find('.swiper-button-prev')[0], 995 breakpoints: { 996 1024: { 997 slidesPerView: 1 998 } 999 }, 1000 onSlideChangeStart: function (swiper) { 1001 var activeIndex = swiper.activeIndex; 1002 1003 _swiperMain.slideTo(activeIndex, 500, false); 1004 } 1005 }); 1006 1007 }, 1008 _updateSwiperMain = function () { 1009 1010 _swiperMain.update(); 1011 _swiperHeaders.update(); 1012 1013 }; 1014 1015 _init(); 1016 }; 1017 1018 var MobileMenu = function (obj) { 1019 1020 //private properties 1021 var _menu = obj, 1022 _subMenu = _menu.find('.menu__sub'), 1023 _menuItems = _menu.find('.menu-item'), 1024 _openSubMenuBtn = _menu.find('.menu__arrow'), 1025 _body = $('body') 1026 _window = $(window); 1027 1028 //private methods 1029 var _onEvents = function () { 1030 _openSubMenuBtn.on({ 1031 'click': function () { 1032 _slideSubMenu($(this)); 1033 } 1034 }); 1035 $('#main-menu').on({ 1036 'click': function (e) { 1037 e.stopPropagation() 1038 console.log('#main-menu'); 1039 if ($(window).width() < 910) { 1040 $('#mobile-menu').slideToggle(); 1041 $('header').toggleClass('mobile-open'); 1042 } 1043 } 1044 }); 1045 $('#mobile-menu').on({ 1046 'click': function (e) { 1047 e.stopPropagation() 1048 1049 } 1050 }); 1051 _window.on({ 1052 resize: function () { 1053 1054 if ($('#mobile-menu').css('display') == 'block') { 1055 $('#mobile-menu').slideUp(); 1056 $('header').removeClass('mobile-open'); 1057 } 1058 1059 } 1060 }); 1061 _body.on({ 1062 click: function () { 1063 1064 if ($('#mobile-menu').css('display') == 'block') { 1065 $('#mobile-menu').slideUp(); 1066 $('header').removeClass('mobile-open'); 1067 } 1068 1069 } 1070 }); 1071 }, 1072 _slideSubMenu = function (elem) { 1073 1074 var curElem = elem, 1075 subMenu = curElem.next('.menu__sub'); 1076 1077 if (curElem.parent().hasClass('opened')) { 1078 1079 curElem.parent().removeClass('opened'); 1080 subMenu.slideUp(300); 1081 1082 } else { 1083 1084 _subMenu.slideUp(300); 1085 _menuItems.removeClass('opened'); 1086 1087 curElem.parent().addClass('opened'); 1088 subMenu.slideDown(300); 1089 1090 } 1091 1092 return false; 1093 1094 }, 1095 _init = function () { 1096 _onEvents(); 1097 }; 1098 1099 _init(); 1100 }; 1101 1102 var Promo = function (obj) { 1103 1104 //private properties 1105 var _obj = obj; 1106 1107 //private methods 1108 var _onEvents = function () { 1109 1110 setTimeout(function () { 1111 1112 _obj.addClass('hide') 1113 1114 setTimeout(function () { 1115 _obj.remove(); 1116 }, 500) 1117 1118 }, 2000) 1119 1120 }, 1121 _init = function () { 1122 _onEvents(); 1123 }; 1124 1125 _init(); 1126 }; 1127 1128 var Showcase = function (obj) { 1129 1130 //private properties 1131 var _obj = obj, 1132 _window = $(window), 1133 _btn = $('.theme-list__btn-more'); 1134 1135 //private methods 1136 var _onEvents = function () { 1137 1138 _btn.on('click', function () { 1139 1140 if (_obj.css('display') == 'none') { 1141 _obj.slideDown('300'); 1142 _btn.addClass('close'); 1143 } else { 1144 _obj.slideUp('300'); 1145 _btn.removeClass('close'); 1146 } 1147 1148 return false; 1149 1150 }); 1151 1152 /*_window.on( 'resize', function () { 1153 1154 if ( _window >= 768 ){ 1155 1156 } 1157 1158 return false; 1159 1160 } );*/ 1161 1162 }, 1163 _init = function () { 1164 _onEvents(); 1165 }; 1166 1167 _init(); 1168 }; 1169 1170})(); 1171 }); 1172})(jQuery);
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.