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