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