1(function($) { 2 3 /* globals jQuery, mfn */ 4 5 "use strict"; 6 7 var scrollTicker, lightboxAttr, sidebar, 8 rtl = $('body').hasClass('rtl'), 9 simple = $('body').hasClass('style-simple'), 10 topBarTop = '61px', 11 headerH = 0, 12 mobileInitW = mfn.mobileInit ? mfn.mobileInit : 1240; 13 14 /** 15 * Lightbox | Magnific Popup 16 */ 17 18 if ( ! mfn.lightbox.disable ) { 19 if ( ! ( mfn.lightbox.disableMobile && ( window.innerWidth < 768 ) ) ) { 20 lightboxAttr = { 21 title: mfn.lightbox.title ? mfn.lightbox.title : false, 22 }; 23 } 24 } 25 26 /** 27 * Admin Bar & WooCommerce Store Notice 28 */ 29 30 function adminBarH() { 31 32 var height = 0; 33 34 // WP adminbar 35 36 if ($('body').hasClass('admin-bar')) { 37 var actionBarH = $('#wpadminbar').innerHeight() || 0; 38 height += actionBarH; 39 } 40 41 // WC demo store 42 43 if ($('body').hasClass('woocommerce-demo-store')) { 44 var demoStoreH = $('body > p.demo_store').innerHeight() || 0; 45 height += demoStoreH; 46 } 47 48 return height; 49 } 50 51 /** 52 * Header | Sticky 53 */ 54 55 function mfnSticky() { 56 57 if( ! $('body').hasClass('sticky-header') ){ 58 return false; 59 } 60 61 if( $('body').hasClass('header-creative') && window.innerWidth >= 768 ){ 62 return false; 63 } 64 65 var startY = headerH; 66 var windowY = $(window).scrollTop(); 67 var topBarH = $('#Top_bar').height() || 0; 68 69 if ( windowY > startY ) { 70 71 if ( ! ( $('#Top_bar').hasClass('is-sticky') ) ) { 72 73 $('.header_placeholder').css('height', topBarH); 74 75 $('#Top_bar') 76 .addClass('is-sticky') 77 .css('top', -60) 78 .animate({ 79 'top': adminBarH() + 'px' 80 }, 300); 81 82 headerWidth(); 83 } 84 85 } else { 86 87 if ($('#Top_bar').hasClass('is-sticky')) { 88 89 $('.header_placeholder').css('height', 0); 90 $('#Top_bar') 91 .removeClass('is-sticky') 92 .css('top', topBarTop); 93 94 stickyLogo(); 95 headerWidth(); 96 97 } 98 99 } 100 101 } 102 103 /** 104 * Header | Sticky | Retina Logo - max height 105 */ 106 107 function stickyLogo() { 108 109 // ! retina display 110 111 if( window.devicePixelRatio <= 1 ){ 112 return false; 113 } 114 115 var parent = $('#Top_bar #logo'), 116 el = $('img.logo-main', parent), 117 height = el.data('height'); 118 119 // ! retina logo set 120 if ( ! parent.hasClass('retina')) { 121 return false; 122 } 123 124 if ( $('body').hasClass('logo-overflow') ) { 125 // do nothing 126 } else if ( height > parent.data('height') ) { 127 height = parent.data('height'); 128 } 129 130 el.css('max-height', height + 'px'); 131 132 } 133 134 /** 135 * Header | Sticky | Height 136 */ 137 138 function mfnStickyH() { 139 140 var topBarH = $('#Top_bar').innerHeight() || 0; 141 142 if ( $('body').hasClass('header-below') ) { 143 144 // header below slider 145 146 var sliderH = $('.mfn-main-slider').innerHeight() || 0; 147 148 headerH = topBarH + sliderH; 149 150 } else { 151 152 // default 153 154 var actionBarH = $('#Action_bar').innerHeight() || 0; 155 156 headerH = topBarH + actionBarH; 157 158 } 159 160 } 161 162 /** 163 * Header | Sticky | Mobile 164 */ 165 166 function mfnMobileSticky() { 167 168 if( ! $('body').hasClass('.mobile-sticky') ){ 169 return false; 170 } 171 172 if( $(window).width() >= 768 ){ 173 return false; 174 } 175 176 var menuH, 177 windowH = $(window).height() || 0, 178 logoH = $('#Top_bar .logo').height() || 0, 179 offset = adminBarH() + logoH; 180 181 if ( ( ! $('#Top_bar').hasClass('is-sticky')) && $('#Action_bar').is(':visible') ) { 182 offset += $('#Action_bar').height() || 0; 183 } 184 185 menuH = windowH - offset; 186 187 if (menuH < 176) { 188 menuH = 176; 189 } 190 191 $('#Top_bar #menu').css('max-height', menuH + 'px'); 192 193 } 194 195 /** 196 * Header | Top bar left | Width 197 */ 198 199 function headerWidth() { 200 var rightW = $('.top_bar_right').innerWidth() || 0; 201 202 if (rightW && !$('body').hasClass('header-plain')) { 203 rightW += 10; 204 } 205 206 var parentW = $('#Top_bar .one').innerWidth() || 0; 207 var leftW = parentW - rightW; 208 209 $('.top_bar_left, .menu > li > ul.mfn-megamenu').css('width', leftW); 210 } 211 212 /** 213 * FIX | Header | Sticky | Height 214 */ 215 216 function fixStickyHeaderH() { 217 218 var stickyH = 0; 219 220 // FIX | sticky top bar height 221 222 var topBar = $('.sticky-header #Top_bar'); 223 224 if (topBar.hasClass('is-sticky')) { 225 stickyH = $('.sticky-header #Top_bar').innerHeight() || 0; 226 } else { 227 topBar.addClass('is-sticky'); 228 stickyH = $('.sticky-header #Top_bar').innerHeight() || 0; 229 topBar.removeClass('is-sticky'); 230 } 231 232 // FIX | responsive 233 234 if ( $(window).width() < mobileInitW ) { 235 236 if ( $(window).width() < 768 ) { 237 238 // mobile 239 if (!$('body').hasClass('mobile-sticky')) { 240 stickyH = 0; 241 } 242 243 } else { 244 245 // tablet 246 if (!$('body').hasClass('tablet-sticky')) { 247 stickyH = 0; 248 } 249 250 } 251 252 } else { 253 254 // desktop 255 256 // FIX | header creative 257 if ($('body').hasClass('header-creative')) { 258 stickyH = 0; 259 } 260 261 } 262 263 return stickyH; 264 } 265 266 /** 267 * Sidebar | Sticky 268 */ 269 270 function mfnSidebarSticky(){ 271 272 var spacing = 0; 273 274 if( ! mfn.sidebarSticky ){ 275 return false;
276 } 277 278 if( ( $('body').hasClass('sticky-header') ) && ( $(window).width() >= mobileInitW ) ){ 279 spacing = 60; 280 } 281 282 sidebar = $('.mcb-sidebar .widget-area').stickySidebar({ 283 topSpacing: spacing 284 }); 285 } 286 287 mfnSidebarSticky(); 288 289 /** 290 * Sidebar | Height 291 */ 292 293 function mfnSidebar() { 294 if ($('.mcb-sidebar').length) { 295 296 var maxH = $('#Content .sections_group').outerHeight(); 297 298 $('.mcb-sidebar').each(function() { 299 $(this).css('min-height', 0); 300 if ($(this).height() > maxH) { 301 maxH = $(this).height(); 302 } 303 }); 304 305 $('.mcb-sidebar').css('min-height', maxH + 'px'); 306 307 if( sidebar ){ 308 sidebar.stickySidebar('updateSticky'); 309 } 310 311 } 312 } 313 314 /** 315 * Section | Full Screen 316 */ 317 318 function mfnSectionH() { 319 320 var windowH = $(window).height() || 0; 321 322 // FIX | next/prev section 323 var offset = 0; 324 if ($('.section.full-screen:not(.hide-desktop)').length > 1) { 325 offset = 5; 326 } 327 328 $('.section.full-screen').each(function() { 329 330 var section = $(this), 331 wrapper = $('.section_wrapper', section); 332 333 section 334 .css('padding', 0) 335 .css('min-height', windowH + offset); 336 337 var wrapperH = wrapper.height() || 0, 338 padding = (windowH + offset - wrapperH) / 2; 339 340 if (padding < 50) padding = 50; 341 342 wrapper 343 .css('padding-top', padding + 10) // 20 = column margin-bottom / 2 344 .css('padding-bottom', padding - 10); 345 }); 346 } 347 348 /** 349 * Equal Height | Wraps 350 */ 351 352 function mfnEqualHeightWrap() { 353 $('.section.equal-height-wrap .section_wrapper').each(function() { 354 var maxH = 0; 355 $( '> .wrap', $(this) ).each( function() { 356 $(this).css('height', 'auto'); 357 if ( $(this).innerHeight() > maxH ) { 358 maxH = $(this).innerHeight(); 359 } 360 }); 361 $('> .wrap', $(this)).css('height', maxH + 'px'); 362 }); 363 } 364 365 /** 366 * Equal Height | Items 367 */ 368 369 function mfnEqualHeight() { 370 $('.section.equal-height .mcb-wrap-inner').each(function() { 371 var maxH = 0; 372 373 $('> .column', $(this)).each(function() { 374 $(this).css('height', 'auto'); 375 if ($(this).height() > maxH) { 376 maxH = $(this).height(); 377 } 378 }); 379 $('> .column', $(this)).css('height', maxH + 'px'); 380 }); 381 } 382 383 384 /** 385 * Into | Full Screen 386 */ 387 388 function mfnIntroH() { 389 390 var windowH = $(window).height() || 0; 391 var headerWrapperH = $('#Header_wrapper').height() || 0; 392 393 windowH = windowH - headerWrapperH - adminBarH(); 394 395 $('#Intro.full-screen').each(function() { 396 397 var el = $(this), 398 inner = $('.intro-inner', el), 399 innerH = inner.height() || 0; 400 401 el.css('padding', 0).css('min-height', windowH); 402 403 var padding = ( windowH - innerH ) / 2; 404 inner.css('padding-top', padding).css('padding-bottom', padding); 405 406 }); 407 } 408 409 /** 410 * Footer | Sliding | Height 411 */ 412 413 function mfnFooter() { 414 415 var footerH = $('#Footer').height() || 0; 416 417 // Fixed, Sliding 418 419 if ($('.footer-fixed #Footer, .footer-sliding #Footer').length) { 420 421 footerH = footerH - 1; 422 $('#Content').css('margin-bottom', footerH + 'px'); 423 424 } 425 426 // Stick to bottom 427 428 if ($('.footer-stick #Footer').length) { 429 430 var headerWrapperH = $('#Header_wrapper').height() || 0; 431 432 var headerFooterH = headerWrapperH + footerH; 433 434 var documentH = $(document).height() - adminBarH(); 435 436 if ( ( documentH <= $(window).height() ) && ( headerFooterH <= $(window).height() ) ) { 437 $('#Footer').addClass('is-sticky'); 438 } else { 439 $('#Footer').removeClass('is-sticky'); 440 } 441 442 } 443 444 } 445 446 /** 447 * Back To Top | Sticky / Show on scroll 448 */ 449 450 function backToTopSticky() { 451 452 if ($('#back_to_top.sticky.scroll').length) { 453 var el = $('#back_to_top.sticky.scroll'); 454 455 // Clear Timeout if one is pending 456 if (scrollTicker) { 457 window.clearTimeout(scrollTicker); 458 scrollTicker = null; 459 } 460 461 el.addClass('focus'); 462 463 // Set Timeout 464 scrollTicker = window.setTimeout(function() { 465 el.removeClass('focus'); 466 }, 1500); // Timeout in msec 467 468 } 469 470 } 471 472 /** 473 * # Hash smooth navigation 474 */ 475 476 function hashNav() { 477 478 var hash = window.location.hash; 479 480 if (hash) { 481 482 // FIX | Master Slider 483 484 if (hash.indexOf("&") > -1 || hash.indexOf("/") > -1) { 485 return false;
486 } 487 488 // Contact Form 7 in popup 489 490 if (hash.indexOf("wpcf7") > -1) { 491 cf7popup(hash); 492 } 493 494 if ($(hash).length) { 495 496 var offset = 0, 497 headerH = fixStickyHeaderH(), 498 tabH = $(hash).siblings('.ui-tabs-nav').innerHeight() || 0; 499 500 // header builder 501 502 if( $('body').hasClass('mhb') ){ 503 504 var currentView = $('.mhb-view').filter(':visible'); 505 headerH = currentView.height() || 0; 506 507 } 508 509 offset = headerH + adminBarH() + tabH; 510 511 $('html, body').animate({ 512 scrollTop: $(hash).offset().top - offset 513 }, 500); 514 } 515 516 } 517 518 } 519 520 /** 521 * One Page | Scroll Active 522 */ 523 524 function onePageActive() { 525 if ($('body').hasClass('one-page')) { 526 527 var stickyH = $('.sticky-header #Top_bar').innerHeight() || 0; 528 var windowT = $(window).scrollTop(); 529 var start = windowT + stickyH + adminBarH() + 1; 530 var first = false; 531 532 $('[data-id]:not(.elementor-element), section[data-id]').each(function() { 533 534 if ($(this).visible(true)) { 535 536 if (!first) { 537 first = $(this); 538 } else if (($(this).offset().top < start) && ($(this).offset().top > first.offset().top)) { 539 first = $(this); 540 } 541 } 542 543 if (first) { 544 545 var newActive = first.attr('data-id'); 546 var active = '[data-hash="' + newActive + '"]'; 547 548 if (newActive) { 549 var menu = $('#menu, .mhb-menu'); 550 menu.find('li').removeClass('current-menu-item current-menu-parent current-menu-ancestor current_page_item current_page_parent current_page_ancestor'); 551 $(active, menu) 552 .closest('li').addClass('current-menu-item') 553 .closest('.menu > li').addClass('current-menu-item'); 554 } 555 556 } 557 558 }); 559 560 } 561 } 562 563 /** 564 * Contact Form 7 | Popup 565 */ 566 567 function cf7popup(hash) { 568 if (hash && $(hash).length) { 569 var id = $(hash).closest('.popup-content').attr('id'); 570 571 $('a.popup-link[href="#' + id + '"]:not(.once)') 572 .addClass('once') 573 .trigger('click'); 574 575 } 576 } 577 578 /** 579 * $(document).ready 580 * Specify a function to execute when the DOM is fully loaded. 581 */ 582 583 $(document).ready(function() { 584 585 /** 586 * Top Bar 587 */ 588 589 $('#Top_bar').removeClass('loading'); 590 591 topBarTop = parseInt($('#Top_bar').css('top'), 10); 592 if (topBarTop < 0) topBarTop = 61; 593 topBarTop = topBarTop + 'px'; 594 595 /** 596 * Menu | Overlay 597 */ 598 599 $('.overlay-menu-toggle').on('click',function(e) { 600 e.preventDefault(); 601 602 $(this).toggleClass('focus'); 603 $('#Overlay').stop(true, true).fadeToggle(500); 604 605 var menuH = $('#Overlay nav').height() || 0; 606 menuH = menuH / 2; 607 608 $('#Overlay nav').css('margin-top', '-' + menuH + 'px'); 609 }); 610 611 $('#Overlay').on('click', '.menu-item > a', function() { 612 $('.overlay-menu-toggle').trigger('click'); 613 }); 614 615 /** 616 * Menu | Responsive | button 617 */ 618 619 $('.responsive-menu-toggle').on('click', function(e) { 620 e.preventDefault(); 621 622 var el = $(this); 623 var menu = $('#Top_bar #menu'); 624 var menuWrap = menu.closest('.top_bar_left'); 625 626 el.toggleClass('active'); 627 628 // sticky menu button 629 if (el.hasClass('is-sticky') && el.hasClass('active') && (window.innerWidth < 768)) { 630 631 var top = 0; 632 if (menuWrap.length) { 633 top = menuWrap.offset().top - adminBarH(); 634 } 635 $('body,html').animate({ 636 scrollTop: top 637 }, 200); 638 639 } 640 641 menu.stop(true, true).slideToggle(200); 642 }); 643 644 /** 645 * Menu | Responsive | Side Slide 646 */ 647 648 function sideSlide() { 649 650 var slide = $('#Side_slide'); 651 var overlay = $('#body_overlay'); 652 var ssMobileInitW = mobileInitW; 653 var pos = 'right'; 654 655 var shiftSlide = -slide.data('width'); 656 var shiftBody = shiftSlide / 2; 657 658 // constructor 659 660 var constructor = function() { 661 if (!slide.hasClass('enabled')) { 662 $('nav#menu').detach().appendTo('#Side_slide .menu_wrapper'); 663 slide.addClass('enabled'); 664 } 665 }; 666 667 // destructor 668 669 var destructor = function() { 670 if (slide.hasClass('enabled')) { 671 close(); 672 $('nav#menu').detach().prependTo('#Top_bar .menu_wrapper'); 673 slide.removeClass('enabled'); 674 } 675 }; 676 677 // reload 678 679 var reload = function() { 680 681 if ( ( window.innerWidth < ssMobileInitW ) ) { 682 constructor(); 683 } else { 684 destructor(); 685 } 686 }; 687 688 // init 689 690 var init = function() { 691 692 if (slide.hasClass('left')) { 693 pos = 'left'; 694 } 695 696 // responsive off 697 if ($('body').hasClass('responsive-off')) { 698 ssMobileInitW = 0; 699 } 700 701 // header simple 702 if ($('body').hasClass('header-simple')) { 703 ssMobileInitW = 9999; 704 } 705 706 reload(); 707 }; 708 709 // reset to default 710 711 var reset = function(time) { 712 713 $('.lang-active.active', slide).removeClass('active').children('i').attr('class', 'icon-down-open-mini'); 714 $('.lang-wrapper', slide).fadeOut(0); 715 716 $('.icon.search.active', slide).removeClass('active'); 717 $('.search-wrapper', slide).fadeOut(0); 718 719 $('.menu_wrapper, .social', slide).fadeIn(time); 720 721 }; 722 723 // menu button 724 725 var button = function() { 726 727 // show 728 729 if (pos == 'left') { 730 slide.animate({ 731 'left': 0 732 }, 300); 733 $('body').animate({ 734 'right': shiftBody 735 }, 300); 736 } else { 737 slide.animate({ 738 'right': 0 739 }, 300); 740 $('body').animate({ 741 'left': shiftBody 742 }, 300); 743 } 744 745 overlay.fadeIn(300); 746 747 // reset 748 749 reset(0); 750 751 }; 752 753 // close 754 755 var close = function() { 756 757 if (pos == 'left') { 758 slide.animate({ 759 'left': shiftSlide 760 }, 300); 761 $('body').animate({ 762 'right': 0 763 }, 300); 764 } else { 765 slide.animate({ 766 'right': shiftSlide 767 }, 300); 768 $('body').animate({ 769 'left': 0 770 }, 300); 771 } 772 773 overlay.fadeOut(300); 774 775 // if page contains revolution slider, trigger resize 776 777 if ($('.rev_slider').length) { 778 setTimeout(function() { 779 $(window).trigger('resize'); 780 }, 300); 781 } 782 783 }; 784 785 // search 786 787 $('.icon.search', slide).on('click', function(e) { 788 789 e.preventDefault(); 790 791 var el = $(this); 792 793 if (el.hasClass('active')) { 794 795 $('.search-wrapper', slide).fadeOut(0); 796 $('.menu_wrapper, .social', slide).fadeIn(300); 797 798 } else { 799 800 $('.search-wrapper', slide).fadeIn(300); 801 $('.menu_wrapper, .social', slide).fadeOut(0); 802 803 $('.lang-active.active', slide).removeClass('active').children('i').attr('class', 'icon-down-open-mini'); 804 $('.lang-wrapper', slide).fadeOut(0); 805 806 } 807 808 el.toggleClass('active'); 809 }); 810 811 // search form submit 812 813 $('a.submit', slide).on('click', function(e) { 814 e.preventDefault(); 815 $('#side-form').submit(); 816 }); 817 818 // lang menu 819 820 $('.lang-active', slide).on('click', function(e) { 821 e.preventDefault(); 822 823 var el = $(this); 824 825 if (el.hasClass('active')) { 826 827 $('.lang-wrapper', slide).fadeOut(0); 828 $('.menu_wrapper, .social', slide).fadeIn(300); 829 el.children('i').attr('class', 'icon-down-open-mini'); 830 831 } else { 832 833 $('.lang-wrapper', slide).fadeIn(300); 834 $('.menu_wrapper, .social', slide).fadeOut(0); 835 el.children('i').attr('class', 'icon-up-open-mini'); 836 837 $('.icon.search.active', slide).removeClass('active'); 838 $('.search-wrapper', slide).fadeOut(0); 839 840 } 841 842 el.toggleClass('active'); 843 }); 844 845 // init, click, debouncedresize 846 847 // init 848 849 init(); 850 851 // click | menu button 852 853 $('.responsive-menu-toggle').off('click'); 854 855 $('.responsive-menu-toggle').on('click', function(e) { 856 e.preventDefault(); 857 button(); 858 }); 859 860 // click | close 861 862 overlay.on('click', function(e) { 863 close(); 864 }); 865 866 $('.close', slide).on('click', function(e) { 867 e.preventDefault(); 868 close(); 869 }); 870 871 // click | below search or languages menu 872 873 $(slide).on('click', function(e) { 874 if ($(e.target).is(slide)) { 875 reset(300); 876 } 877 }); 878 879 // debouncedresize 880 881 $(window).on('debouncedresize', reload); 882 883 } 884 885 if ($('body').hasClass('mobile-side-slide')) { 886 sideSlide(); 887 } 888 889 /** 890 * Gallery | WordPress Gallery 891 */ 892 893 // WordPress <= 4.9 | content 894 895 $('.sections_group .gallery').each(function() { 896 897 var el = $(this); 898 var id = el.attr('id'); 899 900 $('> br', el).remove(); 901 902 $('.gallery-icon > a', el) 903 .wrap('<div class="image_frame scale-with-grid"><div class="image_wrapper"></div></div>') 904 .prepend('<div class="mask"></div>') 905 .children('img') 906 .css('height', 'auto') 907 .css('width', '100%'); 908 909 // lightbox | link to media file 910 911 if (el.hasClass('file')) { 912 $('.gallery-icon a', el) 913 .attr('rel', 'prettyphoto[' + id + ']') 914 .attr('data-elementor-lightbox-slideshow', id); // FIX: elementor lightbox gallery 915 } 916 917 // isotope for masonry layout 918 919 if (el.hasClass('masonry')) { 920 921 el.isotope({ 922 itemSelector: '.gallery-item', 923 layoutMode: 'masonry', 924 isOriginLeft: rtl ? false : true 925 }); 926 927 } 928 929 }); 930 931 // WordPress >
931= 5.0 | content 932 933 $('.sections_group .wp-block-gallery').each(function(index) { 934 935 var el = $(this); 936 var link = $('.blocks-gallery-item a', el); 937 938 // lightbox | link to media file 939 940 if ((/\.(gif|jpg|jpeg|png)$/i).test(link.attr('href'))) { 941 link.attr('rel', 'prettyphoto[wp5-gallery-' + index + ']'); 942 } 943 944 }); 945 946 // widgets 947 948 $('.widget_media_gallery .gallery').each(function() { 949 950 var el = $(this); 951 var id = el.attr('id'); 952 953 // lightbox | link to media file 954 955 $('.gallery-icon a', el).attr('rel', 'prettyphoto[widget-' + id + ']'); 956 957 }); 958 959 /** 960 * Lightbox | PrettyPhoto 961 */ 962 963 $('a[rel^="prettyphoto[portfolio]"]').each(function() { 964 965 var el = $(this); 966 var parent = el.closest('.column'); 967 var index = $('.column').index(parent); 968 969 el.attr('rel', 'prettyphoto[portfolio-' + index + ']'); 970 971 }); 972 973 /** 974 * Lightbox | Magnific Popup 975 * with prettyPhoto backward compatibility 976 */ 977 978 function lightbox() { 979 980 var galleries = []; 981 982 // init 983 984 var init = function() { 985 986 if (lightboxAttr) { 987 compatibility(); 988 setType(); 989 constructor(); 990 } 991 992 }; 993 994 // backward compatibility for prettyPhoto 995 996 var compatibility = function() { 997 998 $('a[rel^="prettyphoto"], a.prettyphoto, a[rel^="prettyphoto"]').each(function() { 999 1000 var el = $(this); 1001 var rel = el.attr('rel'); 1002 1003 if (rel) { 1004 rel = rel.replace('prettyphoto', 'lightbox'); 1005 } else { 1006 rel = 'lightbox'; 1007 } 1008 1009 // Visual Composer prettyPhoto 1010 var dataRel = el.attr('data-rel'); 1011 if (dataRel) { 1012 rel = dataRel.replace('prettyPhoto', 'lightbox'); 1013 el.removeAttr('data-rel'); 1014 } 1015 1016 el.removeClass('prettyphoto').attr('rel', rel); 1017 1018 }); 1019 1020 }; 1021 1022 // check if item is a part of gallery 1023 1024 var isGallery = function(rel) { 1025 1026 if (!rel) { 1027 return false; 1028 } 1029 1030 var regExp = /\[(?:.*)\]/; 1031 var gallery = regExp.exec(rel); 1032 1033 if (gallery) { 1034 gallery = gallery[0]; 1035 gallery = gallery.replace('[', '').replace(']', ''); 1036 return gallery; 1037 } 1038 1039 return false; 1040 }; 1041 1042 // set array of names of galleries 1043 1044 var setGallery = function(gallery) { 1045 1046 if (galleries.indexOf(gallery) == -1) { 1047 galleries.push(gallery); 1048 return true; 1049 } 1050 1051 return false; 1052 }; 1053 1054 // get file type by link 1055 1056 var getType = function(src) { 1057 1058 if (src.match(/youtube\.com\/watch/i) || src.match(/youtube\.com\/embed/i) || src.match(/youtu\.be/i)) { 1059 return 'iframe'; 1060 1061 } else if (src.match(/youtube-nocookie\.com/i)) { 1062 return 'iframe'; 1063 1064 } else if (src.match(/vimeo\.com/i)) { 1065 return 'iframe'; 1066 1067 } else if (src.match(/\biframe=true\b/i)) { 1068 return 'ajax'; 1069 1070 } else if (src.match(/\bajax=true\b/i)) { 1071 return 'ajax'; 1072 1073 } else if (src.substr(0, 1) == '#') { 1074 return 'inline'; 1075 1076 } else { 1077 return 'image'; 1078 1079 } 1080 }; 1081 1082 // set file type 1083 1084 var setType = function() { 1085 1086 $('a[rel^="lightbox"]').each(function() { 1087 1088 var el = $(this); 1089 var href = el.attr('href'); 1090 var rel = el.attr('rel'); 1091 1092 if (href) { 1093 1094 // gallery 1095 1096 var gallery = isGallery(rel); 1097 1098 if (gallery) { 1099 el.attr('data-type', 'gallery'); 1100 setGallery(gallery); 1101 return true; 1102 } 1103 1104 el.attr('data-type', getType(href)); 1105 1106 // iframe paremeters 1107 1108 if (getType(href) == 'iframe') { 1109 el.attr('href', href.replace('&rel=0', '')); 1110 } 1111 } 1112 1113 }); 1114 1115 }; 1116 1117 // constructor 1118 1119 var constructor = function() { 1120 1121 var attr = { 1122 autoFocusLast: false, 1123 removalDelay: 160, 1124 image: { 1125 titleSrc: function(item) { 1126 var img = item.el.closest('.image_wrapper, li').find('img').first(); 1127 if (lightboxAttr.title && img.length) { 1128 return img.attr('alt'); 1129 } else { 1130 return false;
1131 } 1132 } 1133 } 1134 }; 1135 1136 // image 1137 1138 $('a[rel^="lightbox"][data-type="image"]').magnificPopup({ 1139 autoFocusLast: attr.autoFocusLast, 1140 removalDelay: attr.removalDelay, 1141 type: 'image', 1142 image: attr.image 1143 }); 1144 1145 // iframe | video 1146 1147 $('a[rel^="lightbox"][data-type="iframe"]').magnificPopup({ 1148 autoFocusLast: attr.autoFocusLast, 1149 removalDelay: attr.removalDelay, 1150 type: 'iframe', 1151 iframe: { 1152 patterns: { 1153 youtube: { 1154 index: 'youtube.com/', 1155 id: 'v=', 1156 src: '//www.youtube.com/embed/%id%?autoplay=1&rel=0' 1157 }, 1158 youtu_be: { 1159 index: 'youtu.be/', 1160 id: '/', 1161 src: '//www.youtube.com/embed/%id%?autoplay=1&rel=0' 1162 }, 1163 nocookie: { 1164 index: 'youtube-nocookie.com/embed/', 1165 id: '/', 1166 src: '//www.youtube-nocookie.com/embed/%id%?autoplay=1&rel=0' 1167 } 1168 } 1169 } 1170 }); 1171 1172 // inline 1173 1174 $('a[rel^="lightbox"][data-type="inline"]').magnificPopup({ 1175 autoFocusLast: attr.autoFocusLast, 1176 type: 'inline', 1177 midClick: true, 1178 callbacks: { 1179 open: function() { 1180 $('.mfp-content').children().addClass('mfp-inline'); 1181 }, 1182 beforeClose: function() { 1183 $('.mfp-content').children().removeClass('mfp-inline'); 1184 } 1185 } 1186 }); 1187 1188 // gallery 1189 1190 for (var i = 0, len = galleries.length; i < len; i++) { 1191 1192 var gallery = '[' + galleries[i] + ']'; 1193 gallery = 'a[rel^="lightbox' + gallery + '"]:visible'; 1194 1195 $(gallery).magnificPopup({ 1196 autoFocusLast: attr.autoFocusLast, 1197 removalDelay: attr.removalDelay, 1198 type: 'image', 1199 image: attr.image, 1200 gallery: { 1201 enabled: true, 1202 tCounter: '<span class="mfp-counter">%curr% / %total%</span>' // markup of counter 1203 } 1204 }); 1205 } 1206 1207 // FIX: disable in Elementor wrapper 1208 1209 $('.elementor a[rel^="lightbox"]:not(.popup-link)').off('click'); 1210 1211 }; 1212 1213 // reload 1214 1215 var reload = function() { 1216 1217 $('a[rel^="lightbox"]').off('click'); 1218 constructor(); 1219 1220 }; 1221 1222 // init 1223 1224 init(); 1225 1226 // isotope:arrange 1227 1228 $(document).on('isotope:arrange', reload); 1229 1230 } 1231 1232 lightbox(); 1233 1234 /** 1235 * Menu | mfnMenu 1236 */ 1237 1238 function mainMenu() { 1239 1240 var mmMobileInitW = mobileInitW; 1241 1242 if ($('body').hasClass('header-simple') || $('#Header_creative.dropdown').length) { 1243 mmMobileInitW = 9999; 1244 } 1245 1246 $('#menu > ul.menu').mfnMenu({ 1247 addLast: true, 1248 arrows: true, 1249 mobileInit: mmMobileInitW, 1250 responsive: mfn.responsive 1251 }); 1252 1253 $('#secondary-menu > ul.secondary-menu').mfnMenu({ 1254 mobileInit: mmMobileInitW, 1255 responsive: mfn.responsive 1256 }); 1257 1258 } 1259 1260 mainMenu(); 1261 1262 /** 1263 * Menu | NOT One Page | .scroll item 1264 * Works with .scroll class 1265 * Since 4.8 replaced with: Page Options > One Page | function: onePageMenu() 1266 */ 1267 1268 function onePageScroll() { 1269 if (!$('body').hasClass('one-page')) { 1270 var menu = $('#menu'); 1271 1272 if (menu.find('li.scroll').length > 1) { 1273 menu.find('li.current-menu-item:not(:first)').removeClass('current-menu-item currenet-menu-parent current-menu-ancestor current-page-ancestor current_page_item current_page_parent current_page_ancestor'); 1274 1275 // menu item click 1276 menu.on('click','a',function() { 1277 $(this).closest('li').siblings('li').removeClass('current-menu-item currenet-menu-parent current-menu-ancestor current-page-ancestor current_page_item current_page_parent current_page_ancestor'); 1278 $(this).closest('li').addClass('current-menu-item'); 1279 }); 1280 } 1281 } 1282 } 1283 onePageScroll(); 1284 1285 /** 1286 * Menu | One Page | Active on Scroll & Click 1287 */ 1288 1289 function onePageMenu() { 1290 if ($('body').hasClass('one-page')) { 1291 1292 var menu = $('#menu'); 1293 1294 // add attr [data-hash] & [data-id] 1295 1296 $('a[href]', menu).each(function() { 1297 1298 var url = $(this).attr('href'); 1299 if (url && url.split('#')[1]) { 1300 1301 // data-hash 1302 var hash = '#' + url.split('#')[1]; 1303 if (hash && $(hash).length) { 1304 // check if element with specified ID exists 1305 $(this).attr('data-hash', hash); 1306 $(hash).attr('data-id', hash); 1307 } 1308 1309 // Visual Composer 1310 var vcHash = '#' + url.split('#')[1]; 1311 var vcClass = '.vc_row.' + url.split('#')[1]; 1312 if (vcClass && $(vcClass).length) { 1313 // check if element with specified Class exists 1314 $(this).attr('data-hash', vcHash); 1315 $(vcClass).attr('data-id', vcHash); 1316 } 1317 1318 } 1319 1320 }); 1321 1322 // active 1323 1324 var hash; 1325 var activeSelector = '.menu > li.current-menu-item, .menu > li.current-menu-parent, .menu > li.current-menu-ancestor, .menu > li.current-page-ancestor, .menu > li.current_page_item, .menu > li.current_page_parent, .menu > li.current_page_ancestor'; 1326 var activeClasses = 'current-menu-item current-menu-parent current-menu-ancestor current-page-ancestor current_page_item current_page_parent current_page_ancestor'; 1327 1328 if ($(activeSelector, menu).length) { 1329 1330 // remove duplicated 1331 $(activeSelector, menu) 1332 .not(':first').removeClass(activeClasses); 1333 1334 // remove if 1st link to section & section is not visible 1335 hash = $(activeSelector, menu).find('a[data-hash]').attr('data-hash'); 1336 1337 if (hash) { 1338 hash = '[data-id="' + hash + '"]'; 1339 1340 if ($(hash).length && $(hash).visible(true)) { 1341 // do nothing 1342 } else { 1343 $(activeSelector, menu).removeClass('current-menu-item current-menu-parent current-menu-ancestor current-page-ancestor current_page_item current_page_parent current_page_ancestor') 1344 .closest('.menu > li').removeClass('current-menu-item current-menu-parent current-menu-ancestor current-page-ancestor current_page_item current_page_parent current_page_ancestor'); 1345 } 1346 } else { 1347 // do nothing 1348 } 1349 1350 } else { 1351 1352 // add to first if none is active 1353 var first = $('.menu:first-child > li:first-child', menu); 1354 var firstA = first.children('a'); 1355 1356 if (firstA.attr('data-hash')) { 1357 hash = firstA.attr('data-hash'); 1358 hash = '[data-id="' + hash + '"]'; 1359 1360 if ($(hash).length && ($(hash).offset().top == adminBarH())) { 1361 first.addClass('current-menu-item'); 1362 } 1363 } 1364 1365 } 1366 1367 // click 1368 1369 $('#menu a[data-hash]').on('click', function(e) { 1370 e.preventDefault(); // only with: body.one-page 1371 1372 // active 1373 1374 menu.find('li').removeClass('current-menu-item'); 1375 $(this) 1376 .closest('li').addClass('current-menu-item') 1377 .closest('.menu > li').addClass('current-menu-item'); 1378 1379 var hash = $(this).attr('data-hash'); 1380 hash = '[data-id="' + hash + '"]'; 1381 1382 // mobile - sticky header - close menu 1383 1384 if ( window.innerWidth < 768 ) { 1385 $('.responsive-menu-toggle').removeClass('active'); 1386 $('#Top_bar #menu').hide(); 1387 } 1388 1389 // offset 1390 1391 var headerFixedAbH = $('.header-fixed.ab-show #Action_bar').innerHeight() || 0; 1392 var tabsHeaderH = $(hash).siblings('.ui-tabs-nav').innerHeight() || 0; 1393 1394 var offset = headerFixedAbH + tabsHeaderH + adminBarH(); 1395 1396 // sticky height 1397 1398 var stickyH = fixStickyHeaderH(); 1399 1400 // FIX | Header below | 1st section 1401 if ($('body').hasClass('header-below') && $('#Content').length) { 1402 if ($(hash).offset().top < ($('#Content').offset().top + 60)) { 1403 stickyH = -1; 1404 } 1405 } 1406 1407 // animate scroll 1408 1409 $('html, body').animate({
1410 scrollTop: $(hash).offset().top - offset - stickyH 1411 }, 500); 1412 1413 }); 1414 1415 } 1416 } 1417 onePageMenu(); 1418 1419 /** 1420 * Header | Creative 1421 */ 1422 1423 var cHeader = 'body:not( .header-open ) #Header_creative', 1424 cHeaderEl = $(cHeader), 1425 cHeaderCurrnet; 1426 1427 function creativeHeader() { 1428 1429 $('.creative-menu-toggle').on('click', function(e) { 1430 e.preventDefault(); 1431 1432 cHeaderEl.addClass('active'); 1433 $('.creative-menu-toggle, .creative-social', cHeaderEl).fadeOut(500); 1434 $('#Action_bar', cHeaderEl).fadeIn(500); 1435 1436 }); 1437 1438 } 1439 creativeHeader(); 1440 1441 $(document).on('mouseenter', cHeader, function() { 1442 cHeaderCurrnet = 1; 1443 }); 1444 1445 $(document).on('mouseleave', cHeader, function() { 1446 cHeaderCurrnet = null; 1447 setTimeout(function() { 1448 if (!cHeaderCurrnet) { 1449 1450 cHeaderEl.removeClass('active'); 1451 $('.creative-menu-toggle, .creative-social', cHeaderEl).fadeIn(500); 1452 $('#Action_bar', cHeaderEl).fadeOut(500); 1453 1454 } 1455 }, 1000); 1456 }); 1457 1458 // Fix: Header Creative & Mobile Sticky | On Resize > 768 px 1459 function creativeHeaderFix() { 1460 if ( $('body').hasClass('header-creative') && window.innerWidth >= 768 ) { 1461 if ($('#Top_bar').hasClass('is-sticky')) { 1462 $('#Top_bar').removeClass('is-sticky'); 1463 } 1464 } 1465 } 1466 1467 /** 1468 * Header | Search 1469 */ 1470 1471 $("#search_button:not(.has-input), #Top_bar .icon_close").on('click', function(e) { 1472 e.preventDefault(); 1473 $('#Top_bar .search_wrapper').fadeToggle() 1474 .find('.field').focus(); 1475 }); 1476 1477 /** 1478 * WPML | Language switcher in the WP Menu 1479 */ 1480 1481 function mfnWPML() { 1482 $('#menu .menu-item-language:not(.menu-item-language-current)').each(function() { 1483 var el = $(this).children('a'); 1484 1485 if (!el.children('span:not(.icl_lang_sel_bracket)').length) { 1486 el.wrapInner('<span></span>'); 1487 } 1488 1489 }); 1490 1491 $('#menu span.icl_lang_sel_bracket').each(function() { 1492 var el = $(this); 1493 el.replaceWith(el.html()); 1494 }); 1495 1496 } 1497 mfnWPML(); 1498 1499 /** 1500 * Breadcrumbs | Remove last item link 1501 */ 1502 1503 function breadcrumbsRemoveLastLink() { 1504 var el = $('.breadcrumbs.no-link').find('li').last(); 1505 var text = el.text(); 1506 el.html(text); 1507 } 1508 breadcrumbsRemoveLastLink(); 1509 1510 /** 1511 * Downcount 1512 */ 1513 1514 $('.downcount').each(function() { 1515 var el = $(this); 1516 el.downCount({ 1517 date: el.attr('data-date'), 1518 offset: el.attr('data-offset') 1519 }); 1520 }); 1521 1522 /** 1523 * Hover | on Touch | .tooltip, .hover_box 1524 */ 1525 1526 $('.tooltip, .hover_box') 1527 .on('touchstart', function() { 1528 $(this).toggleClass('hover'); 1529 }) 1530 .on('touchend', function() { 1531 $(this).removeClass('hover'); 1532 }); 1533 1534 /** 1535 * Popup | Contact Form | Button 1536 */ 1537 1538 $("#popup_contact .footer_button").on('click', function(e) { 1539 e.preventDefault(); 1540 $(this).parent().toggleClass('focus'); 1541 }); 1542 1543 /** 1544 * Scroll | niceScroll for Header Creative 1545 */ 1546 1547 if ( ('#Header_creative.scroll').length && window.innerWidth >= 1240 ) { 1548 $('#Header_creative.scroll').niceScroll({ 1549 autohidemode: false, 1550 cursorborder: 0, 1551 cursorborderradius: 5, 1552 cursorcolor: '#222222', 1553 cursorwidth: 0, 1554 horizrailenabled: false, 1555 mousescrollstep: 40, 1556 scrollspeed: 60 1557 }); 1558 } 1559 1560 /** 1561 * Sliding Top 1562 */ 1563 1564 $('.sliding-top-control').on('click', function(e) { 1565 e.preventDefault(); 1566 $('#Sliding-top .widgets_wrapper').slideToggle(); 1567 $('#Sliding-top').toggleClass('active'); 1568 }); 1569 1570 /** 1571 * Alert 1572 */ 1573 1574 $('body').on('click', '.alert .close', function(e) { 1575 e.preventDefault(); 1576 $(this).closest('.alert').hide(300); 1577 }); 1578 1579 /** 1580 * Navigation Arrows | Sticky 1581 */ 1582 1583 $('.fixed-nav').appendTo('body'); 1584 1585 /** 1586 * Feature List 1587 */ 1588 1589 $('.feature_list').each(function() { 1590 var col = $(this).attr('data-col') ? $(this).attr('data-col') : 4;
1591 $(this).find('li:nth-child(' + col + 'n):not(:last-child)').after('<hr />'); 1592 }); 1593 1594 /** 1595 * IE Fixes 1596 */ 1597 1598 function checkIE() { 1599 // IE 9 1600 var ua = window.navigator.userAgent; 1601 var msie = ua.indexOf("MSIE "); 1602 if (msie > 0 && parseInt(ua.substring(msie + 5, ua.indexOf(".", msie))) == 9) { 1603 $("body").addClass("ie"); 1604 } 1605 } 1606 checkIE(); 1607 1608 /** 1609 * Parallax 1610 */ 1611 1612 var ua = navigator.userAgent, 1613 isMobileWebkit = /WebKit/.test(ua) && /Mobile/.test(ua); 1614 1615 if ( ! isMobileWebkit && window.innerWidth >= 768 ) { 1616 1617 if (mfn.parallax == 'stellar') { 1618 1619 // Stellar 1620 $.stellar({ 1621 horizontalScrolling: false, 1622 responsive: true 1623 }); 1624 1625 } else { 1626 1627 // Enllax 1628 $(window).enllax(); 1629 1630 } 1631 1632 } else { 1633 1634 $('div[data-enllax-ratio], div[data-stellar-ratio]').css('background-attachment', 'scroll'); 1635 1636 } 1637 1638 /** 1639 * Load More | Ajax 1640 */ 1641 1642 $('.pager_load_more').on('click', function(e) { 1643 e.preventDefault(); 1644 1645 var el = $(this); 1646 var pager = el.closest('.pager_lm'); 1647 var href = el.attr('href'); 1648 1649 // index | for many items on the page 1650 var index = $('.lm_wrapper').index(el.closest('.isotope_wrapper').find('.lm_wrapper')); 1651 1652 el.fadeOut(50); 1653 pager.addClass('loading'); 1654 1655 $.get( href, function( data ) { 1656 1657 // content 1658 1659 var content = $('.lm_wrapper:eq(' + index + ')', data).wrapInner('').html(); 1660 var $content = $(content); 1661 1662 if ($('.lm_wrapper:eq(' + index + ')').hasClass('isotope')) { 1663 1664 // isotope 1665 $('.lm_wrapper:eq(' + index + ')').append( $content ).isotope('appended', $content); 1666 1667 } else { 1668 1669 // default 1670 $content.hide().appendTo('.lm_wrapper:eq(' + index + ')').fadeIn(1000); 1671 1672 } 1673 1674 // next page link 1675 1676 href = $('.lm_wrapper:eq(' + index + ')', data).next().find('.pager_load_more').attr('href'); 1677 pager.removeClass('loading'); 1678 if (href) { 1679 el.fadeIn(); 1680 el.attr('href', href); 1681 } 1682 1683 // refresh some staff 1684 1685 mfnJPlayer(); 1686 lightbox(); 1687 1688 // isotope fix: second resize 1689 1690 $('.lm_wrapper.isotope').imagesLoaded().progress(function() { 1691 $('.lm_wrapper.isotope').isotope(); 1692 }); 1693 1694 }); 1695 1696 }); 1697 1698 /** 1699 * Filters | Blog & Portfolio 1700 */ 1701 1702 $('.filters_buttons .open').on('click', function(e) { 1703 e.preventDefault(); 1704 var type = $(this).closest('li').attr('class'); 1705 1706 $('.filters_wrapper').show(200); 1707 $('.filters_wrapper ul.' + type).show(200); 1708 $('.filters_wrapper ul:not(.' + type + ')').hide(); 1709 }); 1710 1711 $('.filters_wrapper .close a').on('click', function(e) { 1712 e.preventDefault(); 1713 $('.filters_wrapper').hide(200); 1714 }); 1715 1716 /** 1717 * Portfolio List | Next v / Prev ^ buttons 1718 */ 1719 1720 $('.portfolio_next_js').on('click', function(e) { 1721 e.preventDefault(); 1722 1723 var item = $(this).closest('.portfolio-item').next(); 1724 1725 if (item.length) { 1726 $('html, body').animate({ 1727 scrollTop: item.offset().top - fixStickyHeaderH() 1728 }, 500); 1729 } 1730 }); 1731 1732 $('.portfolio_prev_js').on('click', function(e) { 1733 e.preventDefault(); 1734 1735 var item = $(this).closest('.portfolio-item').prev(); 1736 1737 if (item.length) { 1738 $('html, body').animate({ 1739 scrollTop: item.offset().top - fixStickyHeaderH() 1740 }, 500); 1741 } 1742 }); 1743 1744 /** 1745 * Link | Smooth Scroll | .scroll 1746 */ 1747 1748 $('.scroll > a, a.scroll').on('click', function(e) { 1749 1750 // prevent default if link directs to the current page 1751 1752 var urlL = location.href.replace(/\/#.*|#.*/, ''); 1753 var urlT = this.href.replace(/\/#.*|#.*/, ''); 1754 1755 if (urlL == urlT) { 1756 e.preventDefault(); 1757 } 1758 1759 var hash = this.hash; 1760 1761 // offset 1762 1763 var headerFixedAbH = $('.header-fixed.ab-show #Action_bar').innerHeight() || 0; 1764 var tabsHeaderH = $(hash).siblings('.ui-tabs-nav').innerHeight() || 0; 1765 1766 var offset = headerFixedAbH + tabsHeaderH + adminBarH(); 1767 1768 // animate scroll 1769 1770 if (hash && $(hash).length) { 1771 1772 $('html, body').animate({
1773 scrollTop: $(hash).offset().top - offset - fixStickyHeaderH() 1774 }, 500); 1775 } 1776 }); 1777 1778 /** 1779 * Tabs 1780 */ 1781 1782 $('.jq-tabs').tabs(); 1783 1784 /** 1785 * Accordion & FAQ 1786 */ 1787 1788 $('.mfn-acc').each(function() { 1789 var el = $(this); 1790 1791 if (el.hasClass('openAll')) { 1792 1793 // show all 1794 el.find('.question') 1795 .addClass("active") 1796 .children(".answer") 1797 .show(); 1798 1799 } else { 1800 1801 // show one 1802 var activeTab = el.attr('data-active-tab'); 1803 if (el.hasClass('open1st')) activeTab = 1; 1804 1805 if (activeTab) { 1806 el.find('.question').eq(activeTab - 1) 1807 .addClass("active") 1808 .children(".answer") 1809 .show(); 1810 } 1811 1812 } 1813 }); 1814 1815 $('.mfn-acc .question > .title').on('click', function() { 1816 1817 if ($(this).parent().hasClass("active")) { 1818 1819 $(this).parent().removeClass("active").children(".answer").slideToggle(100); 1820 1821 } else { 1822 1823 if (!$(this).closest('.mfn-acc').hasClass('toggle')) { 1824 $(this).parents(".mfn-acc").children().each(function() { 1825 if ($(this).hasClass("active")) { 1826 $(this).removeClass("active").children(".answer").slideToggle(100); 1827 } 1828 }); 1829 } 1830 $(this).parent().addClass("active"); 1831 $(this).next(".answer").slideToggle(100); 1832 1833 } 1834 1835 setTimeout(function() { 1836 $(window).trigger('resize'); 1837 }, 50); 1838 1839 }); 1840 1841 // Visual Composer | Accordion | Sidebar height 1842 $('.wpb_wrapper .vc_tta-panel-title').on('click', 'a', function() { 1843 1844 setTimeout(function() { 1845 $(window).trigger('resize'); 1846 }, 50); 1847 1848 }); 1849 1850 /** 1851 * Helper 1852 */ 1853 1854 $('.helper .link.toggle').on('click', function(e) { 1855 1856 e.preventDefault(); 1857 1858 var el = $(this); 1859 var id = el.attr('data-rel'); 1860 var parent = el.closest('.helper'); 1861 1862 if (el.hasClass('active')) { 1863 1864 el.removeClass('active'); 1865 parent.find('.helper_content > .item-' + id).removeClass('active').slideUp(200); 1866 1867 } else { 1868 1869 parent.find('.links > .link.active').removeClass('active'); 1870 parent.find('.helper_content > .item.active').slideUp(200); 1871 1872 el.addClass('active'); 1873 parent.find('.helper_content > .item-' + id).addClass('active').slideDown(200); 1874 1875 } 1876 1877 setTimeout(function() { 1878 $(window).trigger('resize'); 1879 }, 50); 1880 1881 }); 1882 1883 /** 1884 * HTML5 Video | jPlayer 1885 */ 1886 1887 function mfnJPlayer() { 1888 $('.mfn-jplayer').each(function() { 1889 1890 var m4v = $(this).attr('data-m4v'), 1891 poster = $(this).attr('data-img'), 1892 swfPath = $(this).attr('data-swf'), 1893 cssSelectorAncestor = '#' + $(this).closest('.mfn-jcontainer').attr('id'); 1894 1895 $(this).jPlayer({ 1896 ready: function() { 1897 $(this).jPlayer('setMedia', { 1898 m4v: m4v, 1899 poster: poster 1900 }); 1901 }, 1902 play: function() { 1903 // To avoid both jPlayers playing together. 1904 $(this).jPlayer('pauseOthers'); 1905 }, 1906 size: { 1907 cssClass: 'jp-video-360p', 1908 width: '100%', 1909 height: '360px' 1910 }, 1911 swfPath: swfPath, 1912 supplied: 'm4v', 1913 cssSelectorAncestor: cssSelectorAncestor, 1914 wmode: 'opaque' 1915 }); 1916 }); 1917 } 1918 mfnJPlayer(); 1919 1920 /** 1921 * Love 1922 */ 1923 1924 $('.mfn-love').on('click', function() { 1925 var el = $(this); 1926 1927 if (el.hasClass('loved')) { 1928 return false; 1929 } 1930 el.addClass('loved'); 1931 1932 var post = { 1933 action: 'mfn_love', 1934 post_id: el.attr('data-id') 1935 }; 1936 1937 $.post(mfn.ajax, post, function(data) { 1938 el.find('.label').html(data); 1939 }); 1940 1941 return false; 1942 }); 1943 1944 /** 1945 * Go to top 1946 */ 1947 1948 $('#back_to_top').on('click', function() { 1949 $('body,html').animate({ 1950 scrollTop: 0 1951 }, 500); 1952 return false; 1953 }); 1954 1955 /** 1956 * Section | Next v / Prev ^ arrows 1957 */ 1958 1959 $('.section .section-nav').on('click', function() { 1960 1961 var el = $(this); 1962 var section = el.closest('.section'); 1963 1964 if (el.hasClass('prev')) { 1965 1966 // Previous Section 1967 if (section.prev().length) { 1968 $('html, body').animate({ 1969 scrollTop: section.prev().offset().top 1970 }, 500); 1971 } 1972 1973 } else { 1974 1975 // Next Section 1976 if (section.next().length) { 1977 $('html, body').animate({ 1978 scrollTop: section.next().offset().top 1979 }, 500); 1980 } 1981 1982 } 1983 }); 1984 1985 /** 1986 * Intro | Scroll v arrow 1987 */ 1988 1989 $('#Intro .intro-next').on('click', function() { 1990 var intro = $(this).closest('#Intro'); 1991 1992 if (intro.next().length) { 1993 $('html, body').animate({ 1994 scrollTop: intro.next().offset().top - fixStickyHeaderH() - adminBarH() 1995 }, 500); 1996 } 1997 }); 1998 1999 /** 2000 * Widget | Muffin Menu | Hover on click 2001 */ 2002 2003 $('.widget_mfn_menu ul.submenus-click').each(function() { 2004 2005 var el = $(this); 2006 2007 $('a', el).on('click', function(e) { 2008 var li = $(this).closest('li'); 2009 2010 if (li.hasClass('hover') || !li.hasClass('menu-item-has-children')) { 2011 // link click 2012 } else { 2013 e.preventDefault(); 2014 li.siblings('li').removeClass('hover') 2015 .find('li').removeClass('hover'); 2016 $(this).closest('li').addClass('hover'); 2017 } 2018 2019 }); 2020 2021 }); 2022 2023 /** 2024 * WooCommerce | Add to cart 2025 */ 2026 2027 function addToCart() { 2028 2029 $('body').on('click', '.add_to_cart_button', function() { 2030 $(this) 2031 .closest('.product') 2032 .addClass('adding-to-cart') 2033 .removeClass('added-to-cart'); 2034 }); 2035 2036 $('body').on('added_to_cart', function() { 2037 $('.adding-to-cart') 2038 .removeClass('adding-to-cart') 2039 .addClass('added-to-cart'); 2040 }); 2041 } 2042 addToCart(); 2043 2044 /** 2045 * WooCommerce | Rating click 2046 */ 2047 2048 $('.woocommerce-product-rating').on('click', function(){ 2049 2050 var el; 2051 2052 if( $('.woocommerce-content .jq-tabs').length ){ 2053 2054 el = $('.woocommerce-content .jq-tabs'); 2055 $('.ui-tabs-nav a[href="#tab-reviews"]', el).trigger('click'); 2056 2057 } else { 2058 2059 el = $('.woocommerce-content .accordion'); 2060 $('#reviews').closest('.question:not(.active)').children('.title').trigger('click'); 2061 2062 } 2063 2064 // offset 2065 2066 var actionBarH = $('.header-fixed.ab-show #Action_bar').innerHeight() || 0; 2067 var offset = actionBarH + adminBarH(); 2068 2069 // animate scroll 2070 2071 $('html, body').animate({ 2072 scrollTop: el.offset().top - offset - fixStickyHeaderH() 2073 }, 500); 2074 2075 }); 2076 2077 /** 2078 * Ajax | Complete 2079 */ 2080 2081 $(document).ajaxComplete(function() { 2082 2083 setTimeout(function() { 2084 $(window).trigger('resize'); 2085 }, 100); 2086 2087 }); 2088 2089 /** 2090 * Isotope 2091 */ 2092 2093 // Isotope | Fiters 2094
2095 function isotopeFilter(domEl, isoWrapper) { 2096 2097 var filter = domEl.attr('data-rel'); 2098 2099 isoWrapper.isotope({ 2100 filter: filter 2101 }); 2102 2103 setTimeout(function() { 2104 $(window).trigger('resize'); 2105 }, 50); 2106 2107 } 2108 2109 // Isotope | Fiters | Click ---------- 2110 2111 $('.isotope-filters .filters_wrapper').find('li:not(.close) a').on('click', function(e) { 2112 e.preventDefault(); 2113 2114 var isoWrapper = $('.isotope'), 2115 filters = $(this).closest('.isotope-filters'), 2116 parent = filters.attr('data-parent'); 2117 2118 if (parent) { 2119 parent = filters.closest('.' + parent); 2120 isoWrapper = parent.find('.isotope').first(); 2121 } 2122 2123 filters.find('li').removeClass('current-cat'); 2124 $(this).closest('li').addClass('current-cat'); 2125 2126 isotopeFilter($(this), isoWrapper); 2127 2128 setTimeout(function() { 2129 $(document).trigger('isotope:arrange'); 2130 }, 500); 2131 }); 2132 2133 // Isotope | Fiters | Reset 2134 2135 $('.isotope-filters .filters_buttons').find('li.reset a').on('click', function(e) { 2136 e.preventDefault(); 2137 2138 $('.isotope-filters .filters_wrapper').find('li').removeClass('current-cat'); 2139 isotopeFilter($(this), $('.isotope')); 2140 }); 2141 2142 /** 2143 * $(window).on('debouncedresize') 2144 * Specify a function to execute on window resize 2145 */ 2146 2147 $(window).on('debouncedresize', function() { 2148 2149 // isotope 2150 2151 $('.masonry.isotope, .masonry.gallery').isotope(); 2152 2153 // sliding footer height 2154 2155 mfnFooter(); 2156 2157 // header width 2158 2159 headerWidth(); 2160 2161 // sidebar height 2162 2163 mfnSidebar(); 2164 2165 // full screen sections 2166 2167 mfnSectionH(); 2168 2169 // intro header 2170 2171 mfnIntroH(); 2172 2173 // equal height 2174 2175 mfnEqualHeightWrap(); 2176 mfnEqualHeight(); 2177 2178 // mobile sticky for header creative 2179 2180 creativeHeaderFix(); 2181 2182 }); 2183 2184 /** 2185 * document.ready 2186 * Initialize document ready functions 2187 */ 2188 2189 mfnSliderBlog(); 2190 mfnSliderClients(); 2191 mfnSliderOffer(); 2192 mfnSliderOfferThumb(); 2193 mfnSliderShop(); 2194 2195 sliderPortfolio(); 2196 sliderTestimonials(); 2197 2198 // sliding footer height 2199 2200 mfnFooter(); 2201 2202 // header width 2203 2204 headerWidth(); 2205 2206 // sidebar height 2207 2208 mfnSidebar(); 2209 2210 // full screen sections 2211 2212 mfnSectionH(); 2213 2214 // intro header 2215 2216 mfnIntroH(); 2217 2218 // equal height 2219 2220 mfnEqualHeightWrap(); 2221 mfnEqualHeight(); 2222 2223 // hash navigation 2224 2225 hashNav(); 2226 2227 }); 2228 2229 /** 2230 * $(window).on('scroll') 2231 * The scroll event is sent to an element when the user scrolls to a different place in the element. 2232 */ 2233 2234 $(window).on('scroll', function() { 2235 2236 // sticky header 2237 2238 mfnSticky(); 2239 mfnMobileSticky(); 2240 2241 // sticky back to top 2242 2243 backToTopSticky(); 2244 2245 // one page scroll active 2246 2247 onePageActive(); 2248 2249 }); 2250 2251 /** 2252 * $(window).on('load') 2253 * window.load 2254 */ 2255 2256 $(window).on('load', function() { 2257 2258 /** 2259 * Elementor plugin 2260 * Disable built-in one page 2261 */ 2262 2263 function elementorDisableOnePage(){ 2264 2265 if( ! $('body').hasClass('one-page') ){ 2266 return false; 2267 } 2268 2269 setTimeout(function(){ 2270 var doc=$(document), 2271 $events=$("a[href*='#']").length ? $._data(doc[0],"events") : null; 2272 if($events && $events.click){ 2273 for(var i=$events.click.length-1; i>=0; i--){ 2274 var handler=$events.click[i]; 2275 if(handler && handler.namespace != "mPS2id" && handler.selector === 'a[href*="#"]' ) doc.off("click",handler.handler); 2276 } 2277 } 2278 }, 300); 2279 2280 } 2281 2282 elementorDisableOnePage(); 2283 2284 /** 2285 * Retina Logo 2286 */ 2287 2288 function retinaLogo() { 2289 2290 // ! retina display 2291 2292 if( window.devicePixelRatio <= 1 ){ 2293 return false; 2294 } 2295 2296 var el, src, height, 2297 parent = $('#Top_bar #logo'), 2298 parentH = parent.data('height'); 2299 2300 var maxH = { 2301 sticky: { 2302 init: 35, 2303 noPadding: 60, 2304 overflow: 110 2305 }, 2306 mobile: { 2307 mini: 50, 2308 miniNoPadding: 60 2309 }, 2310 mobileSticky: { 2311 init: 50, 2312 noPadding: 60, 2313 overflow: 80 2314 } 2315 }; 2316 2317 $('#Top_bar #logo img').each(function(index) { 2318 2319 el = $(this); 2320 src = el.data('retina'); 2321 height = el.height() || 0; 2322 2323 // main 2324 2325 if (el.hasClass('logo-main')) { 2326 2327 if ($('body').hasClass('logo-overflow')) { 2328 2329 // do nothing 2330 2331 } else if (height > parentH) { 2332 2333 height = parentH; 2334 2335 } 2336 2337 } 2338 2339 // sticky 2340 2341 if (el.hasClass('logo-sticky')) { 2342 2343 if ($('body').hasClass('logo-overflow')) { 2344 2345 if (height > maxH.sticky.overflow) { 2346 height = maxH.sticky.overflow; 2347 } 2348 2349 } else if ($('body').hasClass('logo-no-sticky-padding')) { 2350 2351 if (height > maxH.sticky.noPadding) { 2352 height = maxH.sticky.noPadding; 2353 } 2354 2355 } else if (height > maxH.sticky.init) { 2356 2357 height = maxH.sticky.init; 2358 2359 } 2360 2361 } 2362 2363 // mobile 2364 2365 if (el.hasClass('logo-mobile')) { 2366 2367 if ($('body').hasClass('mobile-header-mini')) { 2368 2369 if (parent.data('padding') > 0) { 2370 2371 if (height > maxH.mobile.mini) { 2372 height = maxH.mobile.mini; 2373 } 2374 2375 } else { 2376 2377 if (height > maxH.mobile.miniNoPadding) { 2378 height = maxH.mobile.miniNoPadding; 2379 } 2380 2381 } 2382 2383 } 2384 2385 } 2386 2387 // mobile-sticky 2388 2389 if (el.hasClass('logo-mobile-sticky')) { 2390 2391 if ($('body').hasClass('logo-no-sticky-padding')) { 2392 2393 if (height > maxH.mobileSticky.noPadding) { 2394 height = maxH.mobileSticky.noPadding; 2395 } 2396 2397 } else if (height > maxH.mobileSticky.init) { 2398 height = maxH.mobileSticky.init; 2399 } 2400 2401 } 2402 2403 // SET 2404 2405 if (src) { 2406 el.parent().addClass('retina'); 2407 el.attr('src', src).css('max-height', height + 'px'); 2408 } 2409 2410 }); 2411 2412 } 2413 2414 setTimeout(function() { 2415 retinaLogo(); 2416 }, 0); // jQuery 3.5 window.load 2417 2418 /** 2419 * Isotope 2420 */ 2421 2422 // Portfolio - Isotope 2423 2424 $('.blog_wrapper .isotope:not( .masonry ), .portfolio_wrapper .isotope:not( .masonry-flat, .masonry-hover, .masonry-minimal )').isotope({ 2425 itemSelector: '.isotope-item', 2426 layoutMode: 'fitRows', 2427 isOriginLeft: rtl ? false : true 2428 }); 2429 2430 // Portfolio - Masonry Flat 2431 2432 $('.portfolio_wrapper .masonry-flat').isotope({ 2433 itemSelector: '.isotope-item', 2434 percentPosition: true, 2435 masonry: { 2436 columnWidth: 1 2437 }, 2438 isOriginLeft: rtl ? false : true 2439 }); 2440 2441 // Blog & Portfolio - Masonry 2442 2443 $('.isotope.masonry, .isotope.masonry-hover, .isotope.masonry-minimal').isotope({ 2444 itemSelector: '.isotope-item', 2445 layoutMode: 'masonry', 2446 isOriginLeft: rtl ? false : true 2447 }); 2448 2449 // Portfolio | Active Category 2450 2451 function portfolioActive() { 2452 2453 var el = $('.isotope-filters .filters_wrapper'); 2454 var active = el.attr('data-cat'); 2455 2456 if (active) { 2457 el.find('li.' + active).addClass('current-cat'); 2458 $('.isotope').isotope({ 2459 filter: '.category-' + active 2460 }); 2461 } 2462 2463 } 2464 2465 portfolioActive(); 2466 2467 /** 2468 * Chart 2469 */ 2470 2471 $('.chart').waypoint({ 2472 2473 offset: '100%', 2474 triggerOnce: true, 2475 handler: function(){ 2476 2477 var el = $(this.element).length ? $(this.element) : $(this); 2478 var lineW = simple ? 4 : 8; 2479 2480 el.easyPieChart({ 2481 animate: 1000, 2482 lineCap: 'circle', 2483 lineWidth: lineW, 2484 size: 140, 2485 scaleColor: false 2486 }); 2487 2488 if (typeof this.destroy !== 'undefined' && $.isFunction(this.destroy)) { 2489 this.destroy(); 2490 } 2491 } 2492 2493 }); 2494 2495 /** 2496 * Skills 2497 */ 2498 2499 $('.bars_list').waypoint({ 2500 2501 offset: '100%', 2502 triggerOnce: true, 2503 handler: function() { 2504 2505 var el = $(this.element).length ? $(this.element) : $(this); 2506 2507 el.addClass('hover'); 2508 2509 if (typeof this.destroy !== 'undefined' && $.isFunction(this.destroy)) { 2510 this.destroy(); 2511 } 2512 } 2513 2514 }); 2515 2516 /** 2517 * Progress Icons 2518 */ 2519 2520 $('.progress_icons').waypoint({ 2521 2522 offset: '100%', 2523 triggerOnce: true, 2524 handler: function() { 2525 2526 var el = $(this.element).length ? $(this.element) : $(this); 2527 var active = el.attr('data-active'); 2528 var color = el.attr('data-color'); 2529 var icon = el.find('.progress_icon'); 2530 var timeout = 200; // timeout in milliseconds 2531 2532 icon.each(function(i) { 2533 if (i < active) { 2534 var time = (i + 1) * timeout; 2535 setTimeout(function() { 2536 $(icon[i]) 2537 .addClass('themebg') 2538 .css('background-color', color); 2539 }, time); 2540 } 2541 }); 2542 2543 if (typeof this.destroy !== 'undefined' && $.isFunction(this.destroy)) { 2544 this.destroy(); 2545 } 2546 } 2547 2548 }); 2549 2550 /** 2551 * Animate Math | Counter, Quick Fact, etc. 2552 */ 2553 2554 $('.animate-math .number').waypoint({ 2555 2556 offset: '100%', 2557 triggerOnce: true, 2558 handler: function() { 2559 2560 var el = $(this.element).length ? $(this.element) : $(this); 2561 var duration = Math.floor((Math.random() * 1000) + 1000); 2562 var to = el.attr('data-to'); 2563 2564 $({ 2565 property: 0 2566 }).animate({ 2567 property: to 2568 }, { 2569 duration: duration, 2570 easing: 'linear', 2571 step: function() { 2572 el.text(Math.floor(this.property)); 2573 }, 2574 complete: function() { 2575 el.text(this.property); 2576 } 2577 }); 2578 2579 if (typeof this.destroy !== 'undefined' && $.isFunction(this.destroy)) { 2580 this.destroy(); 2581 } 2582 } 2583 2584 }); 2585 2586 /** 2587 * Before After | TwentyTwenty 2588 */ 2589 2590 $('.before_after.twentytwenty-container').twentytwenty(); 2591 2592 // Visual Composer prettyPhoto | off 2593 2594 if ( lightboxAttr ) { 2595 $('a[data-rel^="prettyPhoto"], a[rel^="lightbox"]').each(function() { 2596 $(this).off('click.prettyphoto'); 2597 }); 2598 } 2599 2600 /** 2601 * Reload some functions on window.load 2602 */ 2603 2604 // sticky header 2605 2606 mfnStickyH(); 2607 mfnSticky(); 2608 mfnMobileSticky(); 2609 2610 // full screen sections 2611 2612 mfnSectionH(); 2613 2614 // hash navigation 2615 2616 hashNav(); 2617 2618 // intro header 2619 2620 mfnIntroH(); 2621 2622 // FIX | jQuery 3.5 window.load 2623 2624 setTimeout(function() { 2625
2626 // triger resize to recalculate some plugins stuff 2627 2628 $(window).trigger('resize'); 2629 2630 // sidebar height 2631 2632 mfnSidebar(); 2633 2634 // sliders 2635 2636 sliderSlider(); 2637 2638 // isotope 2639 2640 $('.isotope').isotope(); 2641 2642 }, 0); 2643 2644 }); 2645 2646 /** 2647 * $(document).on('mouseup') 2648 * Specify a function to execute when the DOM is fully loaded. 2649 */ 2650 2651 $(document).on('mouseup',function(e) { 2652 2653 // Widget | Muffin Menu | Hover on click 2654 2655 if ($('.widget_mfn_menu ul.submenus-click').length && ($('.widget_mfn_menu ul.submenus-click').has(e.target).length === 0) ) { 2656 $('.widget_mfn_menu ul.submenus-click li').removeClass('hover'); 2657 } 2658 2659 // Mobile Menu | Classic | Close on click outside menu 2660 2661 if ($('.menu_wrapper').length && ( $('.menu_wrapper').has(e.target).length === 0 )) { 2662 if( $('.responsive-menu-toggle').hasClass('active') ){ 2663 $('.responsive-menu-toggle').trigger('click'); 2664 } 2665 } 2666 2667 }); 2668 2669 /** 2670 * Sliders configuration 2671 */ 2672 2673 // Slick Slider | Auto responsive 2674 2675 function slickAutoResponsive(slider, max, size) { 2676 2677 if (!max){ 2678 max = 5; 2679 } 2680 if (!size){ 2681 size = 380; 2682 } 2683 2684 var width = slider.width() || 0, 2685 count = Math.ceil(width / size); 2686 2687 if (count < 1) count = 1; 2688 if (count > max) count = max; 2689 2690 return count; 2691 } 2692 2693 // Slider | Offer Thumb 2694 2695 function mfnSliderOfferThumb() { 2696 2697 var pager = function(el, i) { 2698 var img = $(el.$slides[i]).find('.thumbnail:first').html(); 2699 return '<a>' + img + '</a>'; 2700 }; 2701 2702 $('.offer_thumb_ul').each(function() { 2703 2704 var slider = $(this); 2705 2706 slider.slick({ 2707 cssEase: 'ease-out', 2708 arrows: false, 2709 dots: true, 2710 infinite: true, 2711 touchThreshold: 10, 2712 speed: 300, 2713 2714 adaptiveHeight: true, 2715 appendDots: slider.siblings('.slider_pagination'), 2716 customPaging: pager, 2717 2718 rtl: rtl ? true : false, 2719 autoplay: mfn.slider.offer ? true : false, 2720 autoplaySpeed: mfn.slider.offer ? mfn.slider.offer : 5000, 2721 2722 slidesToShow: 1, 2723 slidesToScroll: 1 2724 }); 2725 2726 }); 2727 } 2728 2729 // Slider | Offer 2730 2731 function mfnSliderOffer() { 2732 $('.offer_ul').each(function() { 2733 2734 var slider = $(this); 2735 2736 slider.slick({ 2737 cssEase: 'ease-out', 2738 dots: false, 2739 infinite: true, 2740 touchThreshold: 10, 2741 speed: 300, 2742 2743 prevArrow: '<a class="slider_prev" href="#"><span class="button_icon"><i class="icon-up-open-big"></i></span></a>', 2744 nextArrow: '<a class="slider_next" href="#"><span class="button_icon"><i class="icon-down-open-big"></i></span></a>', 2745 2746 adaptiveHeight: true, 2747 //customPaging : pager, 2748 2749 rtl: rtl ? true : false, 2750 autoplay: mfn.slider.offer ? true : false, 2751 autoplaySpeed: mfn.slider.offer ? mfn.slider.offer : 5000, 2752 2753 slidesToShow: 1, 2754 slidesToScroll: 1 2755 }); 2756 2757 // Pagination | Show (css) 2758 2759 slider.siblings('.slider_pagination').addClass('show'); 2760 2761 // Pager | Set slide number after change 2762 2763 slider.on('afterChange', function(event, slick, currentSlide, nextSlide) { 2764 slider.siblings('.slider_pagination').find('.current').text(currentSlide + 1); 2765 }); 2766 2767 }); 2768 } 2769 2770 // Slider | Shop 2771 2772 function mfnSliderShop() { 2773 2774 var pager = function(el, i) { 2775 return '<a>' + i + '</a>'; 2776 }; 2777 2778 $('.shop_slider_ul').each(function() { 2779 2780 var slider = $(this); 2781 var slidesToShow = 4; 2782 2783 var count = slider.closest('.shop_slider').data('count'); 2784 if (slidesToShow > count) { 2785 slidesToShow = count; 2786 if (slidesToShow < 1) { 2787 slidesToShow = 1; 2788 } 2789 } 2790 2791 slider.slick({ 2792 cssEase: 'ease-out', 2793 dots: true, 2794 infinite: true, 2795 touchThreshold: 10, 2796 speed: 300, 2797 2798 prevArrow: '<a class="button the-icon slider_prev" href="#"><span class="button_icon"><i class="icon-left-open-big"></i></span></a>', 2799 nextArrow: '<a class="button the-icon slider_next" href="#"><span class="button_icon"><i class="icon-right-open-big"></i></span></a>', 2800 appendArrows: slider.siblings('.blog_slider_header').children('.slider_navigation'), 2801 2802 appendDots: slider.siblings('.slider_pager'), 2803 customPaging: pager, 2804 2805 rtl: rtl ? true : false, 2806 autoplay: mfn.slider.shop ? true : false, 2807 autoplaySpeed: mfn.slider.shop ? mfn.slider.shop : 5000, 2808 2809 slidesToShow: slickAutoResponsive(slider, slidesToShow), 2810 slidesToScroll: slickAutoResponsive(slider, slidesToShow) 2811 }); 2812 2813 // ON | debouncedresize 2814 2815 $(window).on('debouncedresize', function() { 2816 slider.slick('slickSetOption', 'slidesToShow', slickAutoResponsive(slider, slidesToShow), false); 2817 slider.slick('slickSetOption', 'slidesToScroll', slickAutoResponsive(slider, slidesToShow), true); 2818 }); 2819 2820 }); 2821 } 2822 2823 // Slider | Blog 2824 2825 function mfnSliderBlog() { 2826 2827 var pager = function(el, i) { 2828 return '<a>' + i + '</a>'; 2829 }; 2830 2831 $('.blog_slider_ul').each(function() { 2832 2833 var slider = $(this); 2834 var slidesToShow = 4; 2835 2836 var count = slider.closest('.blog_slider').data('count'); 2837 if (slidesToShow > count) { 2838 slidesToShow = count; 2839 if (slidesToShow < 1) { 2840 slidesToShow = 1; 2841 } 2842 } 2843 2844 slider.slick({ 2845 cssEase: 'ease-out', 2846 dots: true, 2847 infinite: true, 2848 touchThreshold: 10, 2849 speed: 300, 2850 2851 prevArrow: '<a class="button the-icon slider_prev" href="#"><span class="button_icon"><i class="icon-left-open-big"></i></span></a>', 2852 nextArrow: '<a class="button the-icon slider_next" href="#"><span class="button_icon"><i class="icon-right-open-big"></i></span></a>', 2853 appendArrows: slider.siblings('.blog_slider_header').children('.slider_navigation'), 2854 2855 appendDots: slider.siblings('.slider_pager'), 2856 customPaging: pager, 2857 2858 rtl: rtl ? true : false, 2859 autoplay: mfn.slider.blog ? true : false, 2860 autoplaySpeed: mfn.slider.blog ? mfn.slider.blog : 5000, 2861 2862 slidesToShow: slickAutoResponsive(slider, slidesToShow), 2863 slidesToScroll: slickAutoResponsive(slider, slidesToShow) 2864 }); 2865 2866 // On | debouncedresize 2867 2868 $(window).on('debouncedresize', function() { 2869 slider.slick('slickSetOption', 'slidesToShow', slickAutoResponsive(slider, slidesToShow), false); 2870 slider.slick('slickSetOption', 'slidesToScroll', slickAutoResponsive(slider, slidesToShow), true); 2871 }); 2872 2873 }); 2874 } 2875 2876 // Slider | Clients 2877 2878 function mfnSliderClients() { 2879 $('.clients_slider_ul').each(function() { 2880 2881 var slider = $(this); 2882 2883 slider.slick({ 2884 cssEase: 'ease-out', 2885 dots: false, 2886 infinite: true, 2887 touchThreshold: 10, 2888 speed: 300, 2889 2890 prevArrow: '<a class="button the-icon slider_prev" href="#"><span class="button_icon"><i class="icon-left-open-big"></i></span></a>', 2891 nextArrow: '<a class="button the-icon slider_next" href="#"><span class="button_icon"><i class="icon-right-open-big"></i></span></a>', 2892 appendArrows: slider.siblings('.blog_slider_header').children('.slider_navigation'), 2893 2894 rtl: rtl ? true : false, 2895 autoplay: mfn.slider.clients ? true : false, 2896 autoplaySpeed: mfn.slider.clients ? mfn.slider.clients : 5000, 2897 2898 slidesToShow: slickAutoResponsive(slider, 4), 2899 slidesToScroll: slickAutoResponsive(slider, 4) 2900 }); 2901 2902 // ON | debouncedresize 2903 2904 $(window).on('debouncedresize', function() { 2905 slider.slick('slickSetOption', 'slidesToShow', slickAutoResponsive(slider, 4), false); 2906 slider.slick('slickSetOption', 'slidesToScroll', slickAutoResponsive(slider, 4), true); 2907 }); 2908 2909 }); 2910 } 2911 2912 // Slider | Portfolio 2913 2914 function sliderPortfolio() { 2915 2916 $('.portfolio_slider_ul').each(function() { 2917 2918 var slider = $(this); 2919 var size = 380; 2920 var scroll = 5; 2921 2922 if (slider.closest('.portfolio_slider').data('size')) { 2923 size = slider.closest('.portfolio_slider').data('size'); 2924 } 2925 2926 if (slider.closest('.portfolio_slider').data('size')) { 2927 scroll = slider.closest('.portfolio_slider').data('scroll'); 2928 } 2929 2930 slider.slick({ 2931 cssEase: 'ease-out', 2932 dots: false, 2933 infinite: true, 2934 touchThreshold: 10, 2935 speed: 300, 2936 2937 prevArrow: '<a class="slider_nav slider_prev themebg" href="#"><i class="icon-left-open-big"></i></a>', 2938 nextArrow: '<a class="slider_nav slider_next themebg" href="#"><i class="icon-right-open-big"></i></a>', 2939 2940 rtl: rtl ? true : false, 2941 autoplay: mfn.slider.portfolio ? true : false, 2942 autoplaySpeed: mfn.slider.portfolio ? mfn.slider.portfolio : 5000, 2943 2944 slidesToShow: slickAutoResponsive(slider, 5, size), 2945 slidesToScroll: slickAutoResponsive(slider, scroll, size) 2946 }); 2947 2948 // ON | debouncedresize 2949 $(window).on('debouncedresize', function() { 2950 slider.slick('slickSetOption', 'slidesToShow', slickAutoResponsive(slider, 5, size), false); 2951 slider.slick('slickSetOption', 'slidesToScroll', slickAutoResponsive(slider, scroll, size), true); 2952 }); 2953 2954 }); 2955 } 2956 2957 // Slider | Slider 2958 2959 function sliderSlider() { 2960 2961 var pager = function(el, i) { 2962 return '<a>' + i + '</a>'; 2963 }; 2964 2965 $('.content_slider_ul').each(function() { 2966 2967 var slider = $(this); 2968 var count = 1; 2969 var centerMode = false;
2970 2971 if (slider.closest('.content_slider').hasClass('carousel')) { 2972 count = slickAutoResponsive(slider); 2973 2974 $(window).on('debouncedresize', function() { 2975 slider.slick('slickSetOption', 'slidesToShow', slickAutoResponsive(slider), false); 2976 slider.slick('slickSetOption', 'slidesToScroll', slickAutoResponsive(slider), true); 2977 }); 2978 } 2979 2980 if (slider.closest('.content_slider').hasClass('center')) { 2981 centerMode = true; 2982 } 2983 2984 slider.slick({ 2985 cssEase: 'cubic-bezier(.4,0,.2,1)', 2986 dots: true, 2987 infinite: true, 2988 touchThreshold: 10, 2989 speed: 300, 2990 2991 centerMode: centerMode, 2992 centerPadding: '20%', 2993 2994 prevArrow: '<a class="button the-icon slider_prev" href="#"><span class="button_icon"><i class="icon-left-open-big"></i></span></a>', 2995 nextArrow: '<a class="button the-icon slider_next" href="#"><span class="button_icon"><i class="icon-right-open-big"></i></span></a>', 2996 2997 adaptiveHeight: true, 2998 appendDots: slider.siblings('.slider_pager'), 2999 customPaging: pager, 3000 3001 rtl: rtl ? true : false, 3002 autoplay: mfn.slider.slider ? true : false, 3003 autoplaySpeed: mfn.slider.slider ? mfn.slider.slider : 5000, 3004 3005 slidesToShow: count, 3006 slidesToScroll: count 3007 }); 3008 3009 // Lightbox | disable on dragstart 3010 3011 var clickEvent = false; 3012 3013 slider.on('dragstart', '.slick-slide a[rel="lightbox"]', function(event) { 3014 if (lightboxAttr) { 3015 var events = $._data(this,'events'); 3016 if( events && Object.prototype.hasOwnProperty.call(events, 'click') ){ 3017 clickEvent = events.click[0]; 3018 $(this).addClass('off-click').off('click'); 3019 } 3020 } 3021 }); 3022 3023 // Lightbox | enable after change 3024 3025 slider.on('afterChange', function(event, slick, currentSlide, nextSlide) { 3026 if (lightboxAttr) { 3027 $('a.off-click[rel="lightbox"]', slider).removeClass('off-click').on('click', clickEvent); 3028 } 3029 }); 3030 3031 }); 3032 } 3033 3034 // Slider | Testimonials 3035 3036 function sliderTestimonials() { 3037 3038 var pager = function(el, i) { 3039 var img = $(el.$slides[i]).find('.single-photo-img').html(); 3040 return '<a>' + img + '</a>'; 3041 }; 3042 3043 $('.testimonials_slider_ul').each(function() { 3044 3045 var slider = $(this); 3046 3047 slider.slick({ 3048 cssEase: 'ease-out', 3049 dots: true, 3050 infinite: true, 3051 touchThreshold: 10, 3052 speed: 300, 3053 3054 prevArrow: '<a class="button the-icon slider_prev" href="#"><span class="button_icon"><i class="icon-left-open-big"></i></span></a>', 3055 nextArrow: '<a class="button the-icon slider_next" href="#"><span class="button_icon"><i class="icon-right-open-big"></i></span></a>', 3056 3057 adaptiveHeight: true, 3058 appendDots: slider.siblings('.slider_pager'), 3059 customPaging: pager, 3060 3061 rtl: rtl ? true : false, 3062 autoplay: mfn.slider.testimonials ? true : false, 3063 autoplaySpeed: mfn.slider.testimonials ? mfn.slider.testimonials : 5000, 3064 3065 slidesToShow: 1, 3066 slidesToScroll: 1 3067 }); 3068 3069 }); 3070 } 3071 3072})(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.