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