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