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'); 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).attr('rel', 'prettyphoto[' + id + ']'); 885 } 886 887 // isotope for masonry layout 888 889 if (el.hasClass('masonry')) { 890 891 el.isotope({ 892 itemSelector: '.gallery-item', 893 layoutMode: 'masonry', 894 isOriginLeft: rtl ? false : true 895 }); 896 897 } 898 899 }); 900 901 // WordPress >
901= 5.0 | content 902 903 $('.sections_group .wp-block-gallery').each(function(index) { 904 905 var el = $(this); 906 var link = $('.blocks-gallery-item a', el); 907 908 // lightbox | link to media file 909 910 if ((/\.(gif|jpg|jpeg|png)$/i).test(link.attr('href'))) { 911 link.attr('rel', 'prettyphoto[wp5-gallery-' + index + ']'); 912 } 913 914 }); 915 916 // widgets 917 918 $('.widget_media_gallery .gallery').each(function() { 919 920 var el = $(this); 921 var id = el.attr('id'); 922 923 // lightbox | link to media file 924 925 $('.gallery-icon a', el).attr('rel', 'prettyphoto[widget-' + id + ']'); 926 927 }); 928 929 /** 930 * Lightbox | PrettyPhoto 931 */ 932 933 $('a[rel^="prettyphoto[portfolio]"]').each(function() { 934 935 var el = $(this); 936 var parent = el.closest('.column'); 937 var index = $('.column').index(parent); 938 939 el.attr('rel', 'prettyphoto[portfolio-' + index + ']'); 940 941 }); 942 943 /** 944 * Lightbox | Magnific Popup 945 * with prettyPhoto backward compatibility 946 */ 947 948 function lightbox() { 949 950 var galleries = []; 951 952 // init 953 954 var init = function() { 955 956 if (lightboxAttr) { 957 compatibility(); 958 setType(); 959 constructor(); 960 } 961 962 }; 963 964 // backward compatibility for prettyPhoto 965 966 var compatibility = function() { 967 968 $('a[rel^="prettyphoto"], a.prettyphoto, a[rel^="prettyphoto"]').each(function() { 969 970 var el = $(this); 971 var rel = el.attr('rel'); 972 973 if (rel) { 974 rel = rel.replace('prettyphoto', 'lightbox'); 975 } else { 976 rel = 'lightbox'; 977 } 978 979 // Visual Composer prettyPhoto 980 var dataRel = el.attr('data-rel'); 981 if (dataRel) { 982 rel = dataRel.replace('prettyPhoto', 'lightbox'); 983 el.removeAttr('data-rel'); 984 } 985 986 el.removeClass('prettyphoto').attr('rel', rel); 987 988 }); 989 990 }; 991 992 // check if item is a part of gallery 993 994 var isGallery = function(rel) { 995 996 if (!rel) { 997 return false; 998 } 999 1000 var regExp = /\[(?:.*)\]/; 1001 var gallery = regExp.exec(rel); 1002 1003 if (gallery) { 1004 gallery = gallery[0]; 1005 gallery = gallery.replace('[', '').replace(']', ''); 1006 return gallery; 1007 } 1008 1009 return false; 1010 }; 1011 1012 // set array of names of galleries 1013 1014 var setGallery = function(gallery) { 1015 1016 if (galleries.indexOf(gallery) == -1) { 1017 galleries.push(gallery); 1018 return true; 1019 } 1020 1021 return false; 1022 }; 1023 1024 // get file type by link 1025 1026 var getType = function(src) { 1027 1028 if (src.match(/youtube\.com\/watch/i) || src.match(/youtube\.com\/embed/i) || src.match(/youtu\.be/i)) { 1029 return 'iframe'; 1030 1031 } else if (src.match(/youtube-nocookie\.com/i)) { 1032 return 'iframe'; 1033 1034 } else if (src.match(/vimeo\.com/i)) { 1035 return 'iframe'; 1036 1037 } else if (src.match(/\biframe=true\b/i)) { 1038 return 'ajax'; 1039 1040 } else if (src.match(/\bajax=true\b/i)) { 1041 return 'ajax'; 1042 1043 } else if (src.substr(0, 1) == '#') { 1044 return 'inline'; 1045 1046 } else { 1047 return 'image'; 1048 1049 } 1050 }; 1051 1052 // set file type 1053 1054 var setType = function() { 1055 1056 $('a[rel^="lightbox"]').each(function() { 1057 1058 var el = $(this); 1059 var href = el.attr('href'); 1060 var rel = el.attr('rel'); 1061 1062 if (href) { 1063 1064 // gallery 1065 var gallery = isGallery(rel); 1066 if (gallery) { 1067 el.attr('data-type', 'gallery'); 1068 setGallery(gallery); 1069 return true; 1070 } 1071 1072 el.attr('data-type', getType(href)); 1073 1074 // iframe paremeters 1075 if (getType(href) == 'iframe') { 1076 el.attr('href', href.replace('&rel=0', '')); 1077 } 1078 } 1079 1080 }); 1081 1082 }; 1083 1084 // constructor 1085 1086 var constructor = function() { 1087 1088 var attr = { 1089 autoFocusLast: false, 1090 removalDelay: 160, 1091 image: { 1092 titleSrc: function(item) { 1093 var img = item.el.closest('.image_wrapper').find('img').first(); 1094 if (lightboxAttr.title && img.length) { 1095 return img.attr('alt'); 1096 } else { 1097 return false;
1098 } 1099 } 1100 } 1101 }; 1102 1103 // image 1104 1105 $('a[rel^="lightbox"][data-type="image"]').magnificPopup({ 1106 autoFocusLast: attr.autoFocusLast, 1107 removalDelay: attr.removalDelay, 1108 type: 'image', 1109 image: attr.image 1110 }); 1111 1112 // iframe | video 1113 1114 $('a[rel^="lightbox"][data-type="iframe"]').magnificPopup({ 1115 autoFocusLast: attr.autoFocusLast, 1116 removalDelay: attr.removalDelay, 1117 type: 'iframe', 1118 iframe: { 1119 patterns: { 1120 youtube: { 1121 index: 'youtube.com/', 1122 id: 'v=', 1123 src: '//www.youtube.com/embed/%id%?autoplay=1&rel=0' 1124 }, 1125 youtu_be: { 1126 index: 'youtu.be/', 1127 id: '/', 1128 src: '//www.youtube.com/embed/%id%?autoplay=1&rel=0' 1129 }, 1130 nocookie: { 1131 index: 'youtube-nocookie.com/embed/', 1132 id: '/', 1133 src: '//www.youtube-nocookie.com/embed/%id%?autoplay=1&rel=0' 1134 } 1135 } 1136 } 1137 }); 1138 1139 // inline 1140 1141 $('a[rel^="lightbox"][data-type="inline"]').magnificPopup({ 1142 autoFocusLast: attr.autoFocusLast, 1143 type: 'inline', 1144 midClick: true, 1145 callbacks: { 1146 open: function() { 1147 $('.mfp-content').children().addClass('mfp-inline'); 1148 }, 1149 beforeClose: function() { 1150 $('.mfp-content').children().removeClass('mfp-inline'); 1151 } 1152 } 1153 }); 1154 1155 // gallery 1156 1157 for (var i = 0, len = galleries.length; i < len; i++) { 1158 1159 var gallery = '[' + galleries[i] + ']'; 1160 gallery = 'a[rel^="lightbox' + gallery + '"]:visible'; 1161 1162 $(gallery).magnificPopup({ 1163 autoFocusLast: attr.autoFocusLast, 1164 removalDelay: attr.removalDelay, 1165 type: 'image', 1166 image: attr.image, 1167 gallery: { 1168 enabled: true, 1169 tCounter: '<span class="mfp-counter">%curr% / %total%</span>' // markup of counter 1170 } 1171 }); 1172 } 1173 1174 }; 1175 1176 // reload 1177 1178 var reload = function() { 1179 1180 $('a[rel^="lightbox"]').off('click'); 1181 constructor(); 1182 1183 }; 1184 1185 // Visual Composer prettyPhoto | off 1186 1187 var offPretty = function() { 1188 1189 if (lightboxAttr) { 1190 $('a[data-rel^="prettyPhoto"], a[rel^="lightbox"]').each(function() { 1191 $(this).off('click.prettyphoto'); 1192 }); 1193 } 1194 1195 }; 1196 1197 // init 1198 1199 init(); 1200 1201 // onload 1202 1203 $(window).on('load', offPretty); 1204 $(document).on('isotope:arrange', reload); 1205 1206 } 1207 1208 lightbox(); 1209 1210 /** 1211 * Menu | mfnMenu 1212 */ 1213 1214 function mainMenu() { 1215 1216 var mmMobileInitW = mobileInitW; 1217 1218 if ($('body').hasClass('header-simple') || $('#Header_creative.dropdown').length) { 1219 mmMobileInitW = 9999; 1220 } 1221 1222 $('#menu > ul.menu').mfnMenu({ 1223 addLast: true, 1224 arrows: true, 1225 mobileInit: mmMobileInitW, 1226 responsive: mfn.responsive 1227 }); 1228 1229 $('#secondary-menu > ul.secondary-menu').mfnMenu({ 1230 mobileInit: mmMobileInitW, 1231 responsive: mfn.responsive 1232 }); 1233 1234 } 1235 1236 mainMenu(); 1237 1238 /** 1239 * Menu | NOT One Page | .scroll item 1240 * Works with .scroll class 1241 * Since 4.8 replaced with: Page Options > One Page | function: onePageMenu() 1242 */ 1243 1244 function onePageScroll() { 1245 if (!$('body').hasClass('one-page')) { 1246 var menu = $('#menu'); 1247 1248 if (menu.find('li.scroll').length > 1) { 1249 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'); 1250 1251 // menu item click 1252 menu.on('click','a',function() { 1253 $(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'); 1254 $(this).closest('li').addClass('current-menu-item'); 1255 }); 1256 } 1257 } 1258 } 1259 onePageScroll(); 1260 1261 /** 1262 * Menu | One Page | Active on Scroll & Click 1263 */ 1264 1265 function onePageMenu() { 1266 if ($('body').hasClass('one-page')) { 1267 1268 var menu = $('#menu'); 1269 1270 // add attr [data-hash] & [data-id] 1271 1272 $('a[href]', menu).each(function() { 1273 1274 var url = $(this).attr('href'); 1275 if (url && url.split('#')[1]) { 1276 1277 // data-hash 1278 var hash = '#' + url.split('#')[1]; 1279 if (hash && $(hash).length) { 1280 // check if element with specified ID exists 1281 $(this).attr('data-hash', hash); 1282 $(hash).attr('data-id', hash); 1283 } 1284 1285 // Visual Composer 1286 var vcHash = '#' + url.split('#')[1]; 1287 var vcClass = '.vc_row.' + url.split('#')[1]; 1288 if (vcClass && $(vcClass).length) { 1289 // check if element with specified Class exists 1290 $(this).attr('data-hash', vcHash); 1291 $(vcClass).attr('data-id', vcHash); 1292 } 1293 1294 } 1295 1296 }); 1297 1298 // active 1299 1300 var hash; 1301 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'; 1302 var activeClasses = 'current-menu-item current-menu-parent current-menu-ancestor current-page-ancestor current_page_item current_page_parent current_page_ancestor'; 1303 1304 if ($(activeSelector, menu).length) { 1305 1306 // remove duplicated 1307 $(activeSelector, menu) 1308 .not(':first').removeClass(activeClasses); 1309 1310 // remove if 1st link to section & section is not visible 1311 hash = $(activeSelector, menu).find('a[data-hash]').attr('data-hash'); 1312 1313 if (hash) { 1314 hash = '[data-id="' + hash + '"]'; 1315 1316 if ($(hash).length && $(hash).visible(true)) { 1317 // do nothing 1318 } else { 1319 $(activeSelector, menu).removeClass('current-menu-item current-menu-parent current-menu-ancestor current-page-ancestor current_page_item current_page_parent current_page_ancestor') 1320 .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'); 1321 } 1322 } else { 1323 // do nothing 1324 } 1325 1326 } else { 1327 1328 // add to first if none is active 1329 var first = $('.menu:first-child > li:first-child', menu); 1330 var firstA = first.children('a'); 1331 1332 if (firstA.attr('data-hash')) { 1333 hash = firstA.attr('data-hash'); 1334 hash = '[data-id="' + hash + '"]'; 1335 1336 if ($(hash).length && ($(hash).offset().top == adminBarH())) { 1337 first.addClass('current-menu-item'); 1338 } 1339 } 1340 1341 } 1342 1343 // click 1344 1345 $('#menu a[data-hash]').on('click', function(e) { 1346 e.preventDefault(); // only with: body.one-page 1347 1348 // active 1349 1350 menu.find('li').removeClass('current-menu-item'); 1351 $(this) 1352 .closest('li').addClass('current-menu-item') 1353 .closest('.menu > li').addClass('current-menu-item'); 1354 1355 var hash = $(this).attr('data-hash'); 1356 hash = '[data-id="' + hash + '"]'; 1357 1358 // mobile - sticky header - close menu 1359 1360 if (window.innerWidth < 768) { 1361 $('.responsive-menu-toggle').removeClass('active'); 1362 $('#Top_bar #menu').hide(); 1363 } 1364 1365 // offset 1366 1367 var headerFixedAbH = $('.header-fixed.ab-show #Action_bar').innerHeight(); 1368 var tabsHeaderH = $(hash).siblings('.ui-tabs-nav').innerHeight(); 1369 1370 var offset = headerFixedAbH + tabsHeaderH + adminBarH(); 1371 1372 // sticky height 1373 1374 var stickyH = fixStickyHeaderH(); 1375 1376 // FIX | Header below | 1st section 1377 if ($('body').hasClass('header-below') && $('#Content').length) { 1378 if ($(hash).offset().top < ($('#Content').offset().top + 60)) { 1379 stickyH = -1; 1380 } 1381 } 1382 1383 // animate scroll 1384 1385 $('html, body').animate({
1386 scrollTop: $(hash).offset().top - offset - stickyH 1387 }, 500); 1388 1389 }); 1390 1391 } 1392 } 1393 onePageMenu(); 1394 1395 /** 1396 * Header | Creative 1397 */ 1398 1399 var cHeader = 'body:not( .header-open ) #Header_creative', 1400 cHeaderEl = $(cHeader), 1401 cHeaderCurrnet; 1402 1403 function creativeHeader() { 1404 1405 $('.creative-menu-toggle').on('click', function(e) { 1406 e.preventDefault(); 1407 1408 cHeaderEl.addClass('active'); 1409 $('.creative-menu-toggle, .creative-social', cHeaderEl).fadeOut(500); 1410 $('#Action_bar', cHeaderEl).fadeIn(500); 1411 1412 }); 1413 1414 } 1415 creativeHeader(); 1416 1417 $(document).on('mouseenter', cHeader, function() { 1418 cHeaderCurrnet = 1; 1419 }); 1420 1421 $(document).on('mouseleave', cHeader, function() { 1422 cHeaderCurrnet = null; 1423 setTimeout(function() { 1424 if (!cHeaderCurrnet) { 1425 1426 cHeaderEl.removeClass('active'); 1427 $('.creative-menu-toggle, .creative-social', cHeaderEl).fadeIn(500); 1428 $('#Action_bar', cHeaderEl).fadeOut(500); 1429 1430 } 1431 }, 1000); 1432 }); 1433 1434 // Fix: Header Creative & Mobile Sticky | On Resize > 768 px 1435 function creativeHeaderFix() { 1436 if ($('body').hasClass('header-creative') && window.innerWidth >= 768) { 1437 if ($('#Top_bar').hasClass('is-sticky')) { 1438 $('#Top_bar').removeClass('is-sticky'); 1439 } 1440 } 1441 } 1442 1443 /** 1444 * Header | Search 1445 */ 1446 1447 $("#search_button:not(.has-input), #Top_bar .icon_close").on('click', function(e) { 1448 e.preventDefault(); 1449 $('#Top_bar .search_wrapper').fadeToggle() 1450 .find('.field').focus(); 1451 }); 1452 1453 /** 1454 * WPML | Language switcher in the WP Menu 1455 */ 1456 1457 function mfnWPML() { 1458 $('#menu .menu-item-language:not(.menu-item-language-current)').each(function() { 1459 var el = $(this).children('a'); 1460 1461 if (!el.children('span:not(.icl_lang_sel_bracket)').length) { 1462 el.wrapInner('<span></span>'); 1463 } 1464 1465 }); 1466 1467 $('#menu span.icl_lang_sel_bracket').each(function() { 1468 var el = $(this); 1469 el.replaceWith(el.html()); 1470 }); 1471 1472 } 1473 mfnWPML(); 1474 1475 /** 1476 * Breadcrumbs | Remove last item link 1477 */ 1478 1479 function breadcrumbsRemoveLastLink() { 1480 var el = $('.breadcrumbs.no-link').find('li').last(); 1481 var text = el.text(); 1482 el.html(text); 1483 } 1484 breadcrumbsRemoveLastLink(); 1485 1486 /** 1487 * Downcount 1488 */ 1489 1490 $('.downcount').each(function() { 1491 var el = $(this); 1492 el.downCount({ 1493 date: el.attr('data-date'), 1494 offset: el.attr('data-offset') 1495 }); 1496 }); 1497 1498 /** 1499 * Hover | on Touch | .tooltip, .hover_box 1500 */ 1501 1502 $('.tooltip, .hover_box') 1503 .on('touchstart', function() { 1504 $(this).toggleClass('hover'); 1505 }) 1506 .on('touchend', function() { 1507 $(this).removeClass('hover'); 1508 }); 1509 1510 /** 1511 * Popup | Contact Form | Button 1512 */ 1513 1514 $("#popup_contact > a.button").on('click', function(e) { 1515 e.preventDefault(); 1516 $(this).parent().toggleClass('focus'); 1517 }); 1518 1519 /** 1520 * Scroll | niceScroll for Header Creative 1521 */ 1522 1523 if (('#Header_creative.scroll').length && window.innerWidth >= 1240) { 1524 $('#Header_creative.scroll').niceScroll({ 1525 autohidemode: false, 1526 cursorborder: 0, 1527 cursorborderradius: 5, 1528 cursorcolor: '#222222', 1529 cursorwidth: 0, 1530 horizrailenabled: false, 1531 mousescrollstep: 40, 1532 scrollspeed: 60 1533 }); 1534 } 1535 1536 /** 1537 * Black & White 1538 */ 1539 1540 function mfnGreyscale() { 1541 $('.greyscale .image_wrapper > a, .greyscale .image_wrapper_tiles, .greyscale.portfolio-photo a, .greyscale .client_wrapper .gs-wrapper').has('img').BlackAndWhite({ 1542 hoverEffect: false, 1543 intensity: 1 // opacity: 0, 0.1, ... 1 1544 }); 1545 } 1546 mfnGreyscale(); 1547 1548 /** 1549 * Sliding Top 1550 */ 1551 1552 $('.sliding-top-control').on('click', function(e) { 1553 e.preventDefault(); 1554 $('#Sliding-top .widgets_wrapper').slideToggle(); 1555 $('#Sliding-top').toggleClass('active'); 1556 }); 1557 1558 /** 1559 * Alert 1560 */ 1561 1562 $('body').on('click', '.alert .close', function(e) { 1563 e.preventDefault(); 1564 $(this).closest('.alert').hide(300); 1565 }); 1566 1567 /** 1568 * Button | mark buttons with icon & label 1569 */ 1570 1571 $('a.button_js').each(function() { 1572 var btn = $(this); 1573 if (btn.find('.button_icon').length && btn.find('.button_label').length) { 1574 btn.addClass('kill_the_icon'); 1575 } 1576 }); 1577 1578 /** 1579 * Navigation Arrows | Sticky 1580 */ 1581 1582 $('.fixed-nav').appendTo('body'); 1583 1584 /** 1585 * Feature List 1586 */ 1587 1588 $('.feature_list').each(function() { 1589 var col = $(this).attr('data-col') ? $(this).attr('data-col') : 4;
1590 $(this).find('li:nth-child(' + col + 'n):not(:last-child)').after('<hr />'); 1591 }); 1592 1593 /** 1594 * IE Fixes 1595 */ 1596 1597 function checkIE() { 1598 // IE 9 1599 var ua = window.navigator.userAgent; 1600 var msie = ua.indexOf("MSIE "); 1601 if (msie > 0 && parseInt(ua.substring(msie + 5, ua.indexOf(".", msie))) == 9) { 1602 $("body").addClass("ie"); 1603 } 1604 } 1605 checkIE(); 1606 1607 /** 1608 * Parallax 1609 */ 1610 1611 var ua = navigator.userAgent, 1612 isMobileWebkit = /WebKit/.test(ua) && /Mobile/.test(ua); 1613 1614 if (!isMobileWebkit && window.innerWidth >= 768) { 1615 1616 if (mfn.parallax == 'stellar') { 1617 1618 // Stellar 1619 $.stellar({ 1620 horizontalScrolling: false, 1621 responsive: true 1622 }); 1623 1624 } else { 1625 1626 // Enllax 1627 $(window).enllax(); 1628 1629 } 1630 1631 } else { 1632 1633 $('div[data-enllax-ratio], div[data-stellar-ratio]').css('background-attachment', 'scroll'); 1634 1635 } 1636 1637 /** 1638 * Load More | Ajax 1639 */ 1640 1641 $('.pager_load_more').on('click', function(e) { 1642 e.preventDefault(); 1643 1644 var el = $(this); 1645 var pager = el.closest('.pager_lm'); 1646 var href = el.attr('href'); 1647 1648 // index | for many items on the page 1649 var index = $('.lm_wrapper').index(el.closest('.isotope_wrapper').find('.lm_wrapper')); 1650 1651 el.fadeOut(50); 1652 pager.addClass('loading'); 1653 1654 $.get(href, function(data) { 1655 1656 // content 1657 var content = $('.lm_wrapper:eq(' + index + ')', data).wrapInner('').html(); 1658 1659 if ($('.lm_wrapper:eq(' + index + ')').hasClass('isotope')) { 1660 // isotope 1661 $('.lm_wrapper:eq(' + index + ')').append($(content)).isotope('reloadItems').isotope({ 1662 sortBy: 'original-order' 1663 }); 1664 } else { 1665 // default 1666 $(content).hide().appendTo('.lm_wrapper:eq(' + index + ')').fadeIn(1000); 1667 } 1668 1669 // next page link 1670 href = $('.lm_wrapper:eq(' + index + ')', data).next().find('.pager_load_more').attr('href'); 1671 pager.removeClass('loading'); 1672 if (href) { 1673 el.fadeIn(); 1674 el.attr('href', href); 1675 } 1676 1677 // refresh some staff 1678 1679 mfnGreyscale(); 1680 mfnJPlayer(); 1681 lightbox(); 1682 1683 // isotope fix: second resize 1684 1685 $('.lm_wrapper.isotope').imagesLoaded().progress(function() { 1686 $('.lm_wrapper.isotope').isotope('layout'); 1687 }); 1688 1689 }); 1690 1691 }); 1692 1693 /** 1694 * Filters | Blog & Portfolio 1695 */ 1696 1697 $('.filters_buttons .open').on('click', function(e) { 1698 e.preventDefault(); 1699 var type = $(this).closest('li').attr('class'); 1700 1701 $('.filters_wrapper').show(200); 1702 $('.filters_wrapper ul.' + type).show(200); 1703 $('.filters_wrapper ul:not(.' + type + ')').hide(); 1704 }); 1705 1706 $('.filters_wrapper .close a').on('click', function(e) { 1707 e.preventDefault(); 1708 $('.filters_wrapper').hide(200); 1709 }); 1710 1711 /** 1712 * Portfolio List | Next v / Prev ^ buttons 1713 */ 1714 1715 $('.portfolio_next_js').on('click', function(e) { 1716 e.preventDefault(); 1717 1718 var item = $(this).closest('.portfolio-item').next(); 1719 1720 if (item.length) { 1721 $('html, body').animate({ 1722 scrollTop: item.offset().top - fixStickyHeaderH() 1723 }, 500); 1724 } 1725 }); 1726 1727 $('.portfolio_prev_js').on('click', function(e) { 1728 e.preventDefault(); 1729 1730 var item = $(this).closest('.portfolio-item').prev(); 1731 1732 if (item.length) { 1733 $('html, body').animate({ 1734 scrollTop: item.offset().top - fixStickyHeaderH() 1735 }, 500); 1736 } 1737 }); 1738 1739 /** 1740 * Link | Smooth Scroll | .scroll 1741 */ 1742 1743 $('.scroll > a, a.scroll').on('click', function(e) { 1744 1745 // prevent default if link directs to the current page 1746 1747 var urlL = location.href.replace(/\/#.*|#.*/, ''); 1748 var urlT = this.href.replace(/\/#.*|#.*/, ''); 1749 1750 if (urlL == urlT) { 1751 e.preventDefault(); 1752 } 1753 1754 var hash = this.hash; 1755 1756 // offset 1757 1758 var headerFixedAbH = $('.header-fixed.ab-show #Action_bar').innerHeight(); 1759 var tabsHeaderH = $(hash).siblings('.ui-tabs-nav').innerHeight(); 1760 1761 var offset = headerFixedAbH + tabsHeaderH + adminBarH(); 1762 1763 // animate scroll 1764 1765 if (hash && $(hash).length) { 1766 1767 $('html, body').animate({
1768 scrollTop: $(hash).offset().top - offset - fixStickyHeaderH() 1769 }, 500); 1770 } 1771 }); 1772 1773 /** 1774 * Tabs 1775 */ 1776 1777 $('.jq-tabs').tabs(); 1778 1779 /** 1780 * Accordion & FAQ 1781 */ 1782 1783 $('.mfn-acc').each(function() { 1784 var el = $(this); 1785 1786 if (el.hasClass('openAll')) { 1787 1788 // show all 1789 el.find('.question') 1790 .addClass("active") 1791 .children(".answer") 1792 .show(); 1793 1794 } else { 1795 1796 // show one 1797 var activeTab = el.attr('data-active-tab'); 1798 if (el.hasClass('open1st')) activeTab = 1; 1799 1800 if (activeTab) { 1801 el.find('.question').eq(activeTab - 1) 1802 .addClass("active") 1803 .children(".answer") 1804 .show(); 1805 } 1806 1807 } 1808 }); 1809 1810 $('.mfn-acc .question > .title').on('click', function() { 1811 1812 if ($(this).parent().hasClass("active")) { 1813 1814 $(this).parent().removeClass("active").children(".answer").slideToggle(100); 1815 1816 } else { 1817 1818 if (!$(this).closest('.mfn-acc').hasClass('toggle')) { 1819 $(this).parents(".mfn-acc").children().each(function() { 1820 if ($(this).hasClass("active")) { 1821 $(this).removeClass("active").children(".answer").slideToggle(100); 1822 } 1823 }); 1824 } 1825 $(this).parent().addClass("active"); 1826 $(this).next(".answer").slideToggle(100); 1827 1828 } 1829 1830 setTimeout(function() { 1831 $(window).trigger('resize'); 1832 }, 50); 1833 1834 }); 1835 1836 // Visual Composer | Accordion | Sidebar height 1837 $('.wpb_wrapper .vc_tta-panel-title').on('click', 'a', function() { 1838 1839 setTimeout(function() { 1840 $(window).trigger('resize'); 1841 }, 50); 1842 1843 }); 1844 1845 /** 1846 * Helper 1847 */ 1848 1849 $('.helper .link.toggle').on('click', function(e) { 1850 1851 e.preventDefault(); 1852 1853 var el = $(this); 1854 var id = el.attr('data-rel'); 1855 var parent = el.closest('.helper'); 1856 1857 if (el.hasClass('active')) { 1858 1859 el.removeClass('active'); 1860 parent.find('.helper_content > .item-' + id).removeClass('active').slideUp(200); 1861 1862 } else { 1863 1864 parent.find('.links > .link.active').removeClass('active'); 1865 parent.find('.helper_content > .item.active').slideUp(200); 1866 1867 el.addClass('active'); 1868 parent.find('.helper_content > .item-' + id).addClass('active').slideDown(200); 1869 1870 } 1871 1872 setTimeout(function() { 1873 $(window).trigger('resize'); 1874 }, 50); 1875 1876 }); 1877 1878 /** 1879 * HTML5 Video | jPlayer 1880 */ 1881 1882 function mfnJPlayer() { 1883 $('.mfn-jplayer').each(function() { 1884 1885 var m4v = $(this).attr('data-m4v'), 1886 poster = $(this).attr('data-img'), 1887 swfPath = $(this).attr('data-swf'), 1888 cssSelectorAncestor = '#' + $(this).closest('.mfn-jcontainer').attr('id'); 1889 1890 $(this).jPlayer({ 1891 ready: function() { 1892 $(this).jPlayer('setMedia', { 1893 m4v: m4v, 1894 poster: poster 1895 }); 1896 }, 1897 play: function() { 1898 // To avoid both jPlayers playing together. 1899 $(this).jPlayer('pauseOthers'); 1900 }, 1901 size: { 1902 cssClass: 'jp-video-360p', 1903 width: '100%', 1904 height: '360px' 1905 }, 1906 swfPath: swfPath, 1907 supplied: 'm4v', 1908 cssSelectorAncestor: cssSelectorAncestor, 1909 wmode: 'opaque' 1910 }); 1911 }); 1912 } 1913 mfnJPlayer(); 1914 1915 /** 1916 * Love 1917 */ 1918 1919 $('.mfn-love').on('click', function() { 1920 var el = $(this); 1921 1922 if (el.hasClass('loved')) { 1923 return false; 1924 } 1925 el.addClass('loved'); 1926 1927 var post = { 1928 action: 'mfn_love', 1929 post_id: el.attr('data-id') 1930 }; 1931 1932 $.post(mfn.ajax, post, function(data) { 1933 el.find('.label').html(data); 1934 }); 1935 1936 return false; 1937 }); 1938 1939 /** 1940 * Go to top 1941 */ 1942 1943 $('#back_to_top').on('click', function() { 1944 $('body,html').animate({ 1945 scrollTop: 0 1946 }, 500); 1947 return false; 1948 }); 1949 1950 /** 1951 * Section | Next v / Prev ^ arrows 1952 */ 1953 1954 $('.section .section-nav').on('click', function() { 1955 1956 var el = $(this); 1957 var section = el.closest('.section'); 1958 1959 if (el.hasClass('prev')) { 1960 1961 // Previous Section 1962 if (section.prev().length) { 1963 $('html, body').animate({ 1964 scrollTop: section.prev().offset().top 1965 }, 500); 1966 } 1967 1968 } else { 1969 1970 // Next Section 1971 if (section.next().length) { 1972 $('html, body').animate({ 1973 scrollTop: section.next().offset().top 1974 }, 500); 1975 } 1976 1977 } 1978 }); 1979 1980 /** 1981 * Intro | Scroll v arrow 1982 */ 1983 1984 $('#Intro .intro-next').on('click', function() { 1985 var intro = $(this).closest('#Intro'); 1986 1987 if (intro.next().length) { 1988 $('html, body').animate({ 1989 scrollTop: intro.next().offset().top - fixStickyHeaderH() - adminBarH() 1990 }, 500); 1991 } 1992 }); 1993 1994 /** 1995 * Widget | Muffin Menu | Hover on click 1996 */ 1997 1998 $('.widget_mfn_menu ul.submenus-click').each(function() { 1999 2000 var el = $(this); 2001 2002 $('a', el).on('click', function(e) { 2003 var li = $(this).closest('li'); 2004 2005 if (li.hasClass('hover') || !li.hasClass('menu-item-has-children')) { 2006 // link click 2007 } else { 2008 e.preventDefault(); 2009 li.siblings('li').removeClass('hover') 2010 .find('li').removeClass('hover'); 2011 $(this).closest('li').addClass('hover'); 2012 } 2013 2014 }); 2015 2016 }); 2017 2018 /** 2019 * WooCommerce | Add to cart 2020 */ 2021 2022 function addToCart() { 2023 2024 $('body').on('click', '.add_to_cart_button', function() { 2025 $(this) 2026 .closest('.product') 2027 .addClass('adding-to-cart') 2028 .removeClass('added-to-cart'); 2029 }); 2030 2031 $('body').on('added_to_cart', function() { 2032 $('.adding-to-cart') 2033 .removeClass('adding-to-cart') 2034 .addClass('added-to-cart'); 2035 }); 2036 } 2037 addToCart(); 2038 2039 /** 2040 * WooCommerce | Rating click 2041 */ 2042 2043 $('.woocommerce-product-rating').on('click', function(){ 2044 2045 var el; 2046 2047 if( $('.woocommerce-content .jq-tabs').length ){ 2048 2049 el = $('.woocommerce-content .jq-tabs'); 2050 $('.ui-tabs-nav a[href="#tab-reviews"]', el).trigger('click'); 2051 2052 } else { 2053 2054 el = $('.woocommerce-content .accordion'); 2055 $('#reviews').closest('.question:not(.active)').children('.title').trigger('click'); 2056 2057 } 2058 2059 // offset 2060 2061 var offset = $('.header-fixed.ab-show #Action_bar').innerHeight() + adminBarH(); 2062 2063 // animate scroll 2064 2065 $('html, body').animate({ 2066 scrollTop: el.offset().top - offset - fixStickyHeaderH() 2067 }, 500); 2068 2069 }); 2070 2071 /** 2072 * Ajax | Complete 2073 */ 2074 2075 $(document).ajaxComplete(function() { 2076 2077 setTimeout(function() { 2078 $(window).trigger('resize'); 2079 }, 100); 2080 2081 }); 2082 2083 /** 2084 * Isotope 2085 */ 2086 2087 // Isotope | Fiters 2088
2089 function isotopeFilter(domEl, isoWrapper) { 2090 2091 var filter = domEl.attr('data-rel'); 2092 isoWrapper.isotope({ 2093 filter: filter 2094 }); 2095 2096 setTimeout(function() { 2097 $(window).trigger('resize'); 2098 }, 50); 2099 2100 } 2101 2102 // Isotope | Fiters | Click ---------- 2103 2104 $('.isotope-filters .filters_wrapper').find('li:not(.close) a').on('click', function(e) { 2105 e.preventDefault(); 2106 2107 var isoWrapper = $('.isotope'), 2108 filters = $(this).closest('.isotope-filters'), 2109 parent = filters.attr('data-parent'); 2110 2111 if (parent) { 2112 parent = filters.closest('.' + parent); 2113 isoWrapper = parent.find('.isotope').first(); 2114 } 2115 2116 filters.find('li').removeClass('current-cat'); 2117 $(this).closest('li').addClass('current-cat'); 2118 2119 isotopeFilter($(this), isoWrapper); 2120 2121 setTimeout(function() { 2122 $(document).trigger('isotope:arrange'); 2123 }, 500); 2124 }); 2125 2126 // Isotope | Fiters | Reset 2127 2128 $('.isotope-filters .filters_buttons').find('li.reset a').on('click', function(e) { 2129 e.preventDefault(); 2130 2131 $('.isotope-filters .filters_wrapper').find('li').removeClass('current-cat'); 2132 isotopeFilter($(this), $('.isotope')); 2133 }); 2134 2135 /** 2136 * $(window).on('debouncedresize') 2137 * Specify a function to execute on window resize 2138 */ 2139 2140 $(window).on('debouncedresize', function() { 2141 2142 // Isotope | Relayout 2143 $('.masonry.isotope').isotope(); 2144 $('.masonry.gallery').isotope('layout'); 2145 2146 // Sliding Footer | Height 2147 mfnFooter(); 2148 2149 // Header Width 2150 mfnHeader(); 2151 2152 // Sidebar Height 2153 mfnSidebar(); 2154 2155 // Full Screen Section 2156 mfnSectionH(); 2157 2158 // Full Screen Intro 2159 mfnIntroH(); 2160 2161 // Equal | Height 2162 mfnEqualHeightWrap(); 2163 mfnEqualHeight(); 2164 2165 // Header Creative & Mobile Sticky 2166 creativeHeaderFix(); 2167 2168 }); 2169 2170 /** 2171 * document.ready 2172 * Initialize document ready functions 2173 */ 2174 2175 mfnSliderBlog(); 2176 mfnSliderClients(); 2177 mfnSliderOffer(); 2178 mfnSliderOfferThumb(); 2179 mfnSliderShop(); 2180 2181 sliderPortfolio(); 2182 sliderSlider(); 2183 sliderTestimonials(); 2184 2185 // Sidebar | Height 2186 mfnSidebar(); 2187 2188 // Sliding Footer | Height 2189 mfnFooter(); 2190 2191 // Header | Width 2192 mfnHeader(); 2193 2194 // Full Screen Section 2195 mfnSectionH(); 2196 // Navigation | Hash 2197 hashNav(); 2198 2199 // Full Screen Intro 2200 mfnIntroH(); 2201 2202 // Equal | Height 2203 mfnEqualHeightWrap(); 2204 mfnEqualHeight(); 2205 }); 2206 2207 /** 2208 * $(window).scroll 2209 * The scroll event is sent to an element when the user scrolls to a different place in the element. 2210 */ 2211 2212 $(window).scroll(function() { 2213 2214 // Header | Sticky 2215 mfnSticky(); 2216 mfnMobileSticky(); 2217 2218 // Back to top | Sticky 2219 backToTopSticky(); 2220 2221 // One Page | Scroll | Active Section 2222 onePageActive(); 2223 2224 }); 2225 2226 /** 2227 * $(window).load 2228 * The load event is sent to an element when it and all sub-elements have been completely loaded. 2229 */ 2230 2231 $(window).load(function() { 2232 2233 /** 2234 * Elementor plugin 2235 * Disable built-in one page 2236 */ 2237 2238 function elementorDisableOnePage(){ 2239 2240 if( ! $('body').hasClass('one-page') ){ 2241 return false; 2242 } 2243 2244 setTimeout(function(){ 2245 var doc=$(document), 2246 $events=$("a[href*='#']").length ? $._data(doc[0],"events") : null; 2247 if($events){ 2248 for(var i=$events.click.length-1; i>=0; i--){ 2249 var handler=$events.click[i]; 2250 if(handler && handler.namespace != "mPS2id" && handler.selector === 'a[href*="#"]' ) doc.off("click",handler.handler); 2251 } 2252 } 2253 }, 300); 2254 2255 } 2256 elementorDisableOnePage(); 2257 2258 /** 2259 * Retina Logo 2260 */ 2261 2262 function retinaLogo() { 2263 if (window.devicePixelRatio > 1) { 2264 2265 var el, src, height, 2266 parent = $('#Top_bar #logo'), 2267 parentH = parent.data('height'); 2268 2269 var maxH = { 2270 sticky: { 2271 init: 35, 2272 noPadding: 60, 2273 overflow: 110 2274 }, 2275 mobile: { 2276 mini: 50, 2277 miniNoPadding: 60 2278 }, 2279 mobileSticky: { 2280 init: 50, 2281 noPadding: 60, 2282 overflow: 80 2283 } 2284 }; 2285 2286 $('#Top_bar #logo img').each(function(index) { 2287 2288 el = $(this); 2289 src = el.data('retina'); 2290 height = el.height(); 2291 2292 // main 2293 2294 if (el.hasClass('logo-main')) { 2295 2296 if ($('body').hasClass('logo-overflow')) { 2297 2298 // do nothing 2299 2300 } else if (height > parentH) { 2301 2302 height = parentH; 2303 2304 } 2305 2306 } 2307 2308 // sticky 2309 2310 if (el.hasClass('logo-sticky')) { 2311 2312 if ($('body').hasClass('logo-overflow')) { 2313 2314 if (height > maxH.sticky.overflow) { 2315 height = maxH.sticky.overflow; 2316 } 2317 2318 } else if ($('body').hasClass('logo-no-sticky-padding')) { 2319 2320 if (height > maxH.sticky.noPadding) { 2321 height = maxH.sticky.noPadding; 2322 } 2323 2324 } else if (height > maxH.sticky.init) { 2325 2326 height = maxH.sticky.init; 2327 2328 } 2329 2330 } 2331 2332 // mobile 2333 2334 if (el.hasClass('logo-mobile')) { 2335 2336 if ($('body').hasClass('mobile-header-mini')) { 2337 2338 if (parent.data('padding') > 0) { 2339 2340 if (height > maxH.mobile.mini) { 2341 height = maxH.mobile.mini; 2342 } 2343 2344 } else { 2345 2346 if (height > maxH.mobile.miniNoPadding) { 2347 height = maxH.mobile.miniNoPadding; 2348 } 2349 2350 } 2351 2352 } 2353 2354 } 2355 2356 // mobile-sticky 2357 2358 if (el.hasClass('logo-mobile-sticky')) { 2359 2360 if ($('body').hasClass('logo-no-sticky-padding')) { 2361 2362 if (height > maxH.mobileSticky.noPadding) { 2363 height = maxH.mobileSticky.noPadding; 2364 } 2365 2366 } else if (height > maxH.mobileSticky.init) { 2367 height = maxH.mobileSticky.init; 2368 } 2369 2370 } 2371 2372 // SET 2373 2374 if (src) { 2375 el.parent().addClass('retina'); 2376 el.attr('src', src).css('max-height', height + 'px'); 2377 } 2378 2379 }); 2380 2381 } 2382 } 2383 retinaLogo(); 2384 2385 /** 2386 * Isotope 2387 */ 2388 2389 // Portfolio - Isotope 2390 2391 $('.blog_wrapper .isotope:not( .masonry ), .portfolio_wrapper .isotope:not( .masonry-flat, .masonry-hover, .masonry-minimal )').isotope({ 2392 itemSelector: '.isotope-item', 2393 layoutMode: 'fitRows', 2394 isOriginLeft: rtl ? false : true 2395 }); 2396 2397 // Portfolio - Masonry Flat 2398 2399 $('.portfolio_wrapper .masonry-flat').isotope({ 2400 itemSelector: '.isotope-item', 2401 percentPosition: true, 2402 masonry: { 2403 columnWidth: 1 2404 }, 2405 isOriginLeft: rtl ? false : true 2406 }); 2407 2408 // Blog & Portfolio - Masonry 2409 2410 $('.isotope.masonry, .isotope.masonry-hover, .isotope.masonry-minimal').isotope({ 2411 itemSelector: '.isotope-item', 2412 layoutMode: 'masonry', 2413 isOriginLeft: rtl ? false : true 2414 }); 2415 2416 // Portfolio | Active Category 2417 2418 function portfolioActive() { 2419 var el = $('.isotope-filters .filters_wrapper'); 2420 var active = el.attr('data-cat'); 2421 2422 if (active) { 2423 el.find('li.' + active).addClass('current-cat'); 2424 $('.isotope').isotope({ 2425 filter: '.category-' + active 2426 }); 2427 } 2428 } 2429 portfolioActive(); 2430 2431 /** 2432 * Chart 2433 */ 2434 2435 $('.chart').waypoint({ 2436 2437 offset: '100%', 2438 triggerOnce: true, 2439 handler: function(){ 2440 2441 var el = $(this.element).length ? $(this.element) : $(this); 2442 var lineW = simple ? 4 : 8; 2443 2444 el.easyPieChart({ 2445 animate: 1000, 2446 lineCap: 'circle', 2447 lineWidth: lineW, 2448 size: 140, 2449 scaleColor: false 2450 }); 2451 2452 if (typeof this.destroy !== 'undefined' && $.isFunction(this.destroy)) { 2453 this.destroy(); 2454 } 2455 } 2456 }); 2457 2458 /** 2459 * Skills 2460 */ 2461 2462 $('.bars_list').waypoint({ 2463 2464 offset: '100%', 2465 triggerOnce: true, 2466 handler: function() { 2467 2468 var el = $(this.element).length ? $(this.element) : $(this); 2469 2470 el.addClass('hover'); 2471 2472 if (typeof this.destroy !== 'undefined' && $.isFunction(this.destroy)) { 2473 this.destroy(); 2474 } 2475 } 2476 }); 2477 2478 /** 2479 * Progress Icons 2480 */ 2481 2482 $('.progress_icons').waypoint({ 2483 2484 offset: '100%', 2485 triggerOnce: true, 2486 handler: function() { 2487 2488 var el = $(this.element).length ? $(this.element) : $(this); 2489 var active = el.attr('data-active'); 2490 var color = el.attr('data-color'); 2491 var icon = el.find('.progress_icon'); 2492 var timeout = 200; // timeout in milliseconds 2493 2494 icon.each(function(i) { 2495 if (i < active) { 2496 var time = (i + 1) * timeout; 2497 setTimeout(function() { 2498 $(icon[i]) 2499 .addClass('themebg') 2500 .css('background-color', color); 2501 }, time); 2502 } 2503 }); 2504 2505 if (typeof this.destroy !== 'undefined' && $.isFunction(this.destroy)) { 2506 this.destroy(); 2507 } 2508 } 2509 }); 2510 2511 /** 2512 * Animate Math | Counter, Quick Fact, etc. 2513 */ 2514 2515 $('.animate-math .number').waypoint({ 2516 2517 offset: '100%', 2518 triggerOnce: true, 2519 handler: function() { 2520 2521 var el = $(this.element).length ? $(this.element) : $(this); 2522 var duration = Math.floor((Math.random() * 1000) + 1000); 2523 var to = el.attr('data-to'); 2524 2525 $({ 2526 property: 0 2527 }).animate({ 2528 property: to 2529 }, { 2530 duration: duration, 2531 easing: 'linear', 2532 step: function() { 2533 el.text(Math.floor(this.property)); 2534 }, 2535 complete: function() { 2536 el.text(this.property); 2537 } 2538 }); 2539 2540 if (typeof this.destroy !== 'undefined' && $.isFunction(this.destroy)) { 2541 this.destroy(); 2542 } 2543 } 2544 }); 2545 2546 /** 2547 * Before After | TwentyTwenty 2548 */ 2549 2550 $('.before_after.twentytwenty-container').twentytwenty(); 2551 2552 /** 2553 * window.load | Init 2554 * Initialize window load functions 2555 */ 2556 2557 // Header | Sticky 2558 mfnStickyH(); 2559 mfnSticky(); 2560 mfnMobileSticky(); 2561 2562 // Full Screen Section 2563 mfnSectionH(); 2564 2565 // Navigation | Hash 2566 hashNav(); 2567 2568 // Full Screen Intro 2569 mfnIntroH(); 2570 2571 // FIX | Revolution Slider Width & Height OnLoad 2572 $(window).trigger('resize'); 2573 2574 // Sidebar | Height 2575 setTimeout(function() { 2576 mfnSidebar(); 2577 }, 10); 2578 2579 }); 2580 2581 /** 2582 * $(document).mouseup 2583 * Specify a function to execute when the DOM is fully loaded. 2584 */ 2585 2586 $(document).mouseup(function(e) { 2587 2588 // Widget | Muffin Menu | Hover on click 2589 2590 if ($('.widget_mfn_menu ul.submenus-click').length && ($('.widget_mfn_menu ul.submenus-click').has(e.target).length === 0) ) { 2591 $('.widget_mfn_menu ul.submenus-click li').removeClass('hover'); 2592 } 2593 2594 // Mobile Menu | Classic | Close on click outside menu 2595 2596 if ($('.menu_wrapper').length && ( $('.menu_wrapper').has(e.target).length === 0 )) { 2597 if( $('.responsive-menu-toggle').hasClass('active') ){ 2598 $('.responsive-menu-toggle').trigger('click'); 2599 } 2600 } 2601 2602 }); 2603 2604 /** 2605 * Sliders configuration 2606 */ 2607 2608 // Slick Slider | Auto responsive 2609 2610 function slickAutoResponsive(slider, max, size) { 2611 2612 if (!max){ 2613 max = 5; 2614 } 2615 if (!size){ 2616 size = 380; 2617 } 2618 2619 var width = slider.width(),
2620 count = Math.ceil(width / size); 2621 2622 if (count < 1) count = 1; 2623 if (count > max) count = max; 2624 2625 return count; 2626 } 2627 2628 // Slider | Offer Thumb 2629 2630 function mfnSliderOfferThumb() { 2631 2632 var pager = function(el, i) { 2633 var img = $(el.$slides[i]).children('.thumbnail').html(); 2634 return '<a>' + img + '</a>'; 2635 }; 2636 2637 $('.offer_thumb_ul').each(function() { 2638 2639 var slider = $(this); 2640 2641 slider.slick({ 2642 cssEase: 'ease-out', 2643 arrows: false, 2644 dots: true, 2645 infinite: true, 2646 touchThreshold: 10, 2647 speed: 300, 2648 2649 adaptiveHeight: true, 2650 appendDots: slider.siblings('.slider_pagination'), 2651 customPaging: pager, 2652 2653 rtl: rtl ? true : false, 2654 autoplay: mfn.slider.offer ? true : false, 2655 autoplaySpeed: mfn.slider.offer ? mfn.slider.offer : 5000, 2656 2657 slidesToShow: 1, 2658 slidesToScroll: 1 2659 }); 2660 2661 }); 2662 } 2663 2664 // Slider | Offer 2665 2666 function mfnSliderOffer() { 2667 $('.offer_ul').each(function() { 2668 2669 var slider = $(this); 2670 2671 slider.slick({ 2672 cssEase: 'ease-out', 2673 dots: false, 2674 infinite: true, 2675 touchThreshold: 10, 2676 speed: 300, 2677 2678 prevArrow: '<a class="button button_large button_js slider_prev" href="#"><span class="button_icon"><i class="icon-up-open-big"></i></span></a>', 2679 nextArrow: '<a class="button button_large button_js slider_next" href="#"><span class="button_icon"><i class="icon-down-open-big"></i></span></a>', 2680 2681 adaptiveHeight: true, 2682 //customPaging : pager, 2683 2684 rtl: rtl ? true : false, 2685 autoplay: mfn.slider.offer ? true : false, 2686 autoplaySpeed: mfn.slider.offer ? mfn.slider.offer : 5000, 2687 2688 slidesToShow: 1, 2689 slidesToScroll: 1 2690 }); 2691 2692 // Pagination | Show (css) 2693 2694 slider.siblings('.slider_pagination').addClass('show'); 2695 2696 // Pager | Set slide number after change 2697 2698 slider.on('afterChange', function(event, slick, currentSlide, nextSlide) { 2699 slider.siblings('.slider_pagination').find('.current').text(currentSlide + 1); 2700 }); 2701 2702 }); 2703 } 2704 2705 // Slider | Shop 2706 2707 function mfnSliderShop() { 2708 2709 var pager = function(el, i) { 2710 return '<a>' + i + '</a>'; 2711 }; 2712 2713 $('.shop_slider_ul').each(function() { 2714 2715 var slider = $(this); 2716 var slidesToShow = 4; 2717 2718 var count = slider.closest('.shop_slider').data('count'); 2719 if (slidesToShow > count) { 2720 slidesToShow = count; 2721 if (slidesToShow < 1) { 2722 slidesToShow = 1; 2723 } 2724 } 2725 2726 slider.slick({ 2727 cssEase: 'ease-out', 2728 dots: true, 2729 infinite: true, 2730 touchThreshold: 10, 2731 speed: 300, 2732 2733 prevArrow: '<a class="button button_js slider_prev" href="#"><span class="button_icon"><i class="icon-left-open-big"></i></span></a>', 2734 nextArrow: '<a class="button button_js slider_next" href="#"><span class="button_icon"><i class="icon-right-open-big"></i></span></a>', 2735 appendArrows: slider.siblings('.blog_slider_header'), 2736 2737 appendDots: slider.siblings('.slider_pager'), 2738 customPaging: pager, 2739 2740 rtl: rtl ? true : false, 2741 autoplay: mfn.slider.shop ? true : false, 2742 autoplaySpeed: mfn.slider.shop ? mfn.slider.shop : 5000, 2743 2744 slidesToShow: slickAutoResponsive(slider, slidesToShow), 2745 slidesToScroll: slickAutoResponsive(slider, slidesToShow) 2746 }); 2747 2748 // ON | debouncedresize 2749 2750 $(window).on('debouncedresize', function() { 2751 slider.slick('slickSetOption', 'slidesToShow', slickAutoResponsive(slider, slidesToShow), false); 2752 slider.slick('slickSetOption', 'slidesToScroll', slickAutoResponsive(slider, slidesToShow), true); 2753 }); 2754 2755 }); 2756 } 2757 2758 // Slider | Blog 2759 2760 function mfnSliderBlog() { 2761 2762 var pager = function(el, i) { 2763 return '<a>' + i + '</a>'; 2764 }; 2765 2766 $('.blog_slider_ul').each(function() { 2767 2768 var slider = $(this); 2769 var slidesToShow = 4; 2770 2771 var count = slider.closest('.blog_slider').data('count'); 2772 if (slidesToShow > count) { 2773 slidesToShow = count; 2774 if (slidesToShow < 1) { 2775 slidesToShow = 1; 2776 } 2777 } 2778 2779 slider.slick({ 2780 cssEase: 'ease-out', 2781 dots: true, 2782 infinite: true, 2783 touchThreshold: 10, 2784 speed: 300, 2785 2786 prevArrow: '<a class="button button_js slider_prev" href="#"><span class="button_icon"><i class="icon-left-open-big"></i></span></a>', 2787 nextArrow: '<a class="button button_js slider_next" href="#"><span class="button_icon"><i class="icon-right-open-big"></i></span></a>', 2788 appendArrows: slider.siblings('.blog_slider_header'), 2789 2790 appendDots: slider.siblings('.slider_pager'), 2791 customPaging: pager, 2792 2793 rtl: rtl ? true : false, 2794 autoplay: mfn.slider.blog ? true : false, 2795 autoplaySpeed: mfn.slider.blog ? mfn.slider.blog : 5000, 2796 2797 slidesToShow: slickAutoResponsive(slider, slidesToShow), 2798 slidesToScroll: slickAutoResponsive(slider, slidesToShow) 2799 }); 2800 2801 // On | debouncedresize 2802 2803 $(window).on('debouncedresize', function() { 2804 slider.slick('slickSetOption', 'slidesToShow', slickAutoResponsive(slider, slidesToShow), false); 2805 slider.slick('slickSetOption', 'slidesToScroll', slickAutoResponsive(slider, slidesToShow), true); 2806 }); 2807 2808 }); 2809 } 2810 2811 // Slider | Clients 2812 2813 function mfnSliderClients() { 2814 $('.clients_slider_ul').each(function() { 2815 2816 var slider = $(this); 2817 2818 slider.slick({ 2819 cssEase: 'ease-out', 2820 dots: false, 2821 infinite: true, 2822 touchThreshold: 10, 2823 speed: 300, 2824 2825 prevArrow: '<a class="button button_js slider_prev" href="#"><span class="button_icon"><i class="icon-left-open-big"></i></span></a>', 2826 nextArrow: '<a class="button button_js slider_next" href="#"><span class="button_icon"><i class="icon-right-open-big"></i></span></a>', 2827 appendArrows: slider.siblings('.clients_slider_header'), 2828 2829 rtl: rtl ? true : false, 2830 autoplay: mfn.slider.clients ? true : false, 2831 autoplaySpeed: mfn.slider.clients ? mfn.slider.clients : 5000, 2832 2833 slidesToShow: slickAutoResponsive(slider, 4), 2834 slidesToScroll: slickAutoResponsive(slider, 4) 2835 }); 2836 2837 // ON | debouncedresize 2838 2839 $(window).on('debouncedresize', function() { 2840 slider.slick('slickSetOption', 'slidesToShow', slickAutoResponsive(slider, 4), false); 2841 slider.slick('slickSetOption', 'slidesToScroll', slickAutoResponsive(slider, 4), true); 2842 }); 2843 2844 }); 2845 } 2846 2847 // Slider | Portfolio 2848 2849 function sliderPortfolio() { 2850 2851 $('.portfolio_slider_ul').each(function() { 2852 2853 var slider = $(this); 2854 var size = 380; 2855 var scroll = 5; 2856 2857 if (slider.closest('.portfolio_slider').data('size')) { 2858 size = slider.closest('.portfolio_slider').data('size'); 2859 } 2860 2861 if (slider.closest('.portfolio_slider').data('size')) { 2862 scroll = slider.closest('.portfolio_slider').data('scroll'); 2863 } 2864 2865 slider.slick({ 2866 cssEase: 'ease-out', 2867 dots: false, 2868 infinite: true, 2869 touchThreshold: 10, 2870 speed: 300, 2871 2872 prevArrow: '<a class="slider_nav slider_prev themebg" href="#"><i class="icon-left-open-big"></i></a>', 2873 nextArrow: '<a class="slider_nav slider_next themebg" href="#"><i class="icon-right-open-big"></i></a>', 2874 2875 rtl: rtl ? true : false, 2876 autoplay: mfn.slider.portfolio ? true : false, 2877 autoplaySpeed: mfn.slider.portfolio ? mfn.slider.portfolio : 5000, 2878 2879 slidesToShow: slickAutoResponsive(slider, 5, size), 2880 slidesToScroll: slickAutoResponsive(slider, scroll, size) 2881 }); 2882 2883 // ON | debouncedresize 2884 $(window).on('debouncedresize', function() { 2885 slider.slick('slickSetOption', 'slidesToShow', slickAutoResponsive(slider, 5, size), false); 2886 slider.slick('slickSetOption', 'slidesToScroll', slickAutoResponsive(slider, scroll, size), true); 2887 }); 2888 2889 }); 2890 } 2891 2892 // Slider | Slider 2893 2894 function sliderSlider() { 2895 2896 var pager = function(el, i) { 2897 return '<a>' + i + '</a>'; 2898 }; 2899 2900 $('.content_slider_ul').each(function() { 2901 2902 var slider = $(this); 2903 var count = 1; 2904 var centerMode = false;
2905 2906 if (slider.closest('.content_slider').hasClass('carousel')) { 2907 count = slickAutoResponsive(slider); 2908 2909 $(window).on('debouncedresize', function() { 2910 slider.slick('slickSetOption', 'slidesToShow', slickAutoResponsive(slider), false); 2911 slider.slick('slickSetOption', 'slidesToScroll', slickAutoResponsive(slider), true); 2912 }); 2913 } 2914 2915 if (slider.closest('.content_slider').hasClass('center')) { 2916 centerMode = true; 2917 } 2918 2919 slider.slick({ 2920 cssEase: 'cubic-bezier(.4,0,.2,1)', 2921 dots: true, 2922 infinite: true, 2923 touchThreshold: 10, 2924 speed: 300, 2925 2926 centerMode: centerMode, 2927 centerPadding: '20%', 2928 2929 prevArrow: '<a class="button button_js slider_prev" href="#"><span class="button_icon"><i class="icon-left-open-big"></i></span></a>', 2930 nextArrow: '<a class="button button_js slider_next" href="#"><span class="button_icon"><i class="icon-right-open-big"></i></span></a>', 2931 2932 adaptiveHeight: true, 2933 appendDots: slider.siblings('.slider_pager'), 2934 customPaging: pager, 2935 2936 rtl: rtl ? true : false, 2937 autoplay: mfn.slider.slider ? true : false, 2938 autoplaySpeed: mfn.slider.slider ? mfn.slider.slider : 5000, 2939 2940 slidesToShow: count, 2941 slidesToScroll: count 2942 }); 2943 2944 // Lightbox | disable on dragstart 2945 2946 var clickEvent = false; 2947 2948 slider.on('dragstart', '.slick-slide a[rel="lightbox"]', function(event) { 2949 if (lightboxAttr) { 2950 var events = $(this).data('events'); 2951 clickEvent = events.click[0]; 2952 $(this).addClass('off-click').off('click'); 2953 } 2954 }); 2955 2956 // Lightbox | enable after change 2957 2958 slider.on('afterChange', function(event, slick, currentSlide, nextSlide) { 2959 if (lightboxAttr) { 2960 $('a.off-click[rel="lightbox"]', slider).removeClass('off-click').on('click', clickEvent); 2961 } 2962 }); 2963 2964 }); 2965 } 2966 2967 // Slider | Testimonials 2968 2969 function sliderTestimonials() { 2970 2971 var pager = function(el, i) { 2972 var img = $(el.$slides[i]).find('.single-photo-img').html(); 2973 return '<a>' + img + '</a>'; 2974 }; 2975 2976 $('.testimonials_slider_ul').each(function() { 2977 2978 var slider = $(this); 2979 2980 slider.slick({ 2981 cssEase: 'ease-out', 2982 dots: true, 2983 infinite: true, 2984 touchThreshold: 10, 2985 speed: 300, 2986 2987 prevArrow: '<a class="button button_js slider_prev" href="#"><span class="button_icon"><i class="icon-left-open-big"></i></span></a>', 2988 nextArrow: '<a class="button button_js slider_next" href="#"><span class="button_icon"><i class="icon-right-open-big"></i></span></a>', 2989 2990 adaptiveHeight: true, 2991 appendDots: slider.siblings('.slider_pager'), 2992 customPaging: pager, 2993 2994 rtl: rtl ? true : false, 2995 autoplay: mfn.slider.testimonials ? true : false, 2996 autoplaySpeed: mfn.slider.testimonials ? mfn.slider.testimonials : 5000, 2997 2998 slidesToShow: 1, 2999 slidesToScroll: 1 3000 }); 3001 3002 }); 3003 } 3004 3005})(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.