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