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