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