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