1 2// ================================================================================== // 3 4 // # Document on Ready 5 // # Document on Resize 6 // # Document on Load 7 8 // # Leader Post Size 9 // # Sticky Sidebar Widget 10 // # Sticky Sidebar 11 // # Feature Section 12 // # Feature Parallax 13 // # Page Settings 14 // # Basic Elements 15 // # Isotope 16 // # Parallax Section 17 // # Section Settings 18 // # Scroll Direction 19 // # Global Variables 20 // # Scrollbar Width 21 // # Full Page 22 23// ================================================================================== // 24 25 26var EUTHEM = EUTHEM || {}; 27 28(function($){ 29 30 "use strict"; 31 32 33 // # Document on Ready 34 // ============================================================================= // 35 EUTHEM.documentReady = { 36 init: function(){ 37 EUTHEM.pageSettings.bodyLoader(); 38 EUTHEM.svgAnimation.init(); 39 EUTHEM.advancedHiddenMenu.init(); 40 EUTHEM.pageSettings.removeVideoBg(); 41 EUTHEM.pageSettings.addVideoBg(); 42 EUTHEM.slideToggleMenu.init( '#eut-hidden-menu', '#eut-hidden-menu .eut-menu' ); 43 EUTHEM.slideToggleMenu.init( '#eut-main-header.eut-header-side', '#eut-main-menu.eut-vertical-menu .eut-menu' ); 44 EUTHEM.slideToggleMenu.init( '#eut-sidearea', '.widget_nav_menu' ); 45 EUTHEM.featureSection.init( '#eut-feature-section' ); 46 EUTHEM.featureParallax.init(); 47 EUTHEM.featureSection.init( '.eut-page-title' ); 48 EUTHEM.pageSettings.init(); 49 EUTHEM.sectionSettings.init(); 50 EUTHEM.leaderPostSize.init(); 51 EUTHEM.isotope.init(); 52 EUTHEM.basicElements.init(); 53 EUTHEM.pageSettings.lightGallery(); 54 EUTHEM.fullPage.init(); 55 EUTHEM.pillingPage.init(); 56 EUTHEM.sectionNav.init(); 57 } 58 }; 59 60 EUTHEM.reCall = { 61 init: function(){ 62 EUTHEM.sectionSettings.init(); 63 } 64 }; 65 66 67 // # Document on Resize 68 // ============================================================================= // 69 EUTHEM.documentResize = { 70 init: function(){ 71 EUTHEM.featureSize.init( '#eut-feature-section' ); 72 EUTHEM.featureSize.init( '.eut-page-title' ); 73 EUTHEM.sectionSettings.init(); 74 EUTHEM.sectionHeight.resetHeight( '.eut-section' ); 75 EUTHEM.anchorMenu.resetSticky( '.eut-anchor-menu' ); 76 EUTHEM.pageSettings.resizeVideoBg(); 77 EUTHEM.pageSettings.stickyElements(); 78 EUTHEM.isotope.relayout(); 79 EUTHEM.pageSettings.closeSideArea(); 80 } 81 }; 82 83 // # Document on Load 84 // ============================================================================= // 85 EUTHEM.documentLoad = { 86 init: function(){ 87 EUTHEM.sectionHeight.init( '.eut-section' ); 88 EUTHEM.parallaxSection.init('#eut-content .eut-bg-parallax'); 89 EUTHEM.parallaxSection.init('.eut-column.eut-bg-parallax'); 90 EUTHEM.anchorMenu.init( '.eut-anchor-menu' ); 91 EUTHEM.stickySidebarWidget.init(); 92 EUTHEM.stickySidebar.init(); 93 EUTHEM.pageSettings.stickyElements(); 94 EUTHEM.basicElements.iconBox(); 95 EUTHEM.pageSettings.columnEffect(); 96 EUTHEM.wooThumbCarousel.init(); 97 EUTHEM.wooProductRating.init(); 98 99 // Location Hash 100 if (window.location.hash) { 101 setTimeout(function() { 102 var target = window.location.hash; 103 if( $(target).length ){ 104 if ( $(target).hasClass('eut-tab-content') || $(target).hasClass('eut-accordion-content') ) { 105 var tabLink = $('.eut-tab-link[data-rel="' + target + '"]:visible'); 106 if ( tabLink.length ) { 107 tabLink.click(); 108 setTimeout(function() { 109 EUTHEM.pageSettings.linkGoToTop( tabLink ); 110 }, 500); 111 } 112 } else { 113 $('html, body').scrollTop( $(target).offset().top ); 114 } 115 } 116 }, 0); 117 } 118 } 119 }; 120 121 // # Section Height 122 // ============================================================================= // 123 EUTHEM.sectionHeight = { 124 init: function(section){ 125 var $section = $(section); 126 EUTHEM.sectionHeight.resetHeight( section ); 127 }, 128 settings: function(element){ 129 130 var windowH = $(window).height(), 131 $section = element; 132 $section.each(function(){ 133 var $that = $(this); 134 135 if( $that.find('.eut-big-post').length || $that.parents('.eut-big-post').length ) { 136 $that.removeClass('eut-loading-height'); 137 return; 138 } 139 140 if( !$that.hasClass('eut-percentage-height') && !$that.find('.eut-percentage-height').length ) return; 141 142 if( $that.hasClass('eut-percentage-height') ){ 143 EUTHEM.sectionHeight.getHeight( $that, windowH ); 144 } 145 var $row = $that.find('.eut-row'), 146 $column = $that.find('.eut-column'), 147 sectionH = $that.hasClass('eut-percentage-height') ? $that.height() : windowH, 148 maxHeight = 0; 149 150 $column.each(function(){ 151 var $col = $(this), 152 $colChild = $col.find('.eut-inner-section.eut-percentage-height'), 153 $colParent = $col.parents('.eut-row'), 154 elementSpace = EUTHEM.sectionHeight.getElementSpace( $colChild ), 155 colHeight = $col.height(), 156 parentH = sectionH - elementSpace; 157 158 $colChild.each(function(){ 159 EUTHEM.sectionHeight.getHeight( $(this), parentH ); 160 }); 161 maxHeight = $colParent.height() > maxHeight ? $colParent.height() : maxHeight; 162 }); 163 164 if( maxHeight >= sectionH ){ 165 $row.css({'min-height' : maxHeight}); 166 } 167 }); 168 169 }, 170 getRatio: function(element){ 171 var ratio, 172 windowWidth = $(window).width() + scrollBarWidth; 173 174 if ( windowWidth > tabletLandscape ) { 175 ratio = element.data('height-ratio') !== undefined ? element.data('height-ratio')/100 : 0; 176 } else if ( windowWidth > tabletPortrait && windowWidth <= tabletLandscape ) { 177 ratio = element.data('tablet-height-ratio') !== undefined ? element.data('tablet-height-ratio')/100 : element.data('height-ratio') !== undefined ? element.data('height-ratio')/100 : 0; 178 } else if ( windowWidth > mobileScreen && windowWidth <= tabletPortrait ) { 179 ratio = element.data('tablet-sm-height-ratio') !== undefined ? element.data('tablet-sm-height-ratio')/100 : element.data('height-ratio') !== undefined ? element.data('height-ratio')/100 : 0; 180 } else { 181 ratio = element.data('mobile-height-ratio') !== undefined ? element.data('mobile-height-ratio')/100 : element.data('height-ratio') !== undefined ? element.data('height-ratio')/100 : 0; 182 } 183 184 return ratio; 185 }, 186 getHeight: function( element, parentH ){ 187 element.css({'height' : 'auto'}); 188 var ratio = EUTHEM.sectionHeight.getRatio( element ), 189 minHeight = element.data('min-height') !== undefined ? element.data('min-height') : 0, 190 paddingT = parseInt( element.css('padding-top') ), 191 paddingB = parseInt( element.css('padding-bottom') ), 192 space = paddingT + paddingB, 193 content = element.find('.eut-percentage-content').first(), 194 contentH = content.height(), 195 elementH = Math.round( parentH * ratio ), 196 height = elementH > minHeight ? elementH - space : minHeight - space; 197 198 EUTHEM.sectionHeight.setHeight( element, content, height, contentH ); 199 }, 200 setHeight: function( element, content, height, contentH ){ 201 if( height > contentH ){
202 content.css({ 'height' : height }); 203 } 204 element.removeClass('eut-loading-height'); 205 }, 206 getElementSpace: function( element ){ 207 var space = element.parent().children('.eut-element, .eut-empty-space'), 208 size = 0; 209 space.each(function(){ 210 size += $(this).outerHeight(); 211 }); 212 return size; 213 }, 214 resetHeight: function( section ){ 215 var $section = $(section), 216 $row = $section.find('.eut-row'), 217 $content = $section.find('.eut-percentage-content'); 218 $section.css({ 'height' : '' }); 219 $row.css({ 'height' : '' }); 220 $content.css({ 'height' : '' }); 221 EUTHEM.sectionHeight.settings( $section ); 222 } 223 }; 224 225 // # Fixed Custom Position Column 226 // ============================================================================= // 227 EUTHEM.customPositionColumn = { 228 init: function(){ 229 $('.eut-column.eut-custom-position').each(function(){ 230 var $column = $(this), 231 columnW, columnX, windowW; 232 233 setup(); 234 235 if( !isMobile.any() ) { 236 $(window).on('resize', resizer); 237 } else { 238 $(window).on('orientationchange', resizer); 239 } 240 function setup(){ 241 resetPosition(); 242 updateParams(); 243 if( columnW + columnX >= windowW ){ 244 resetPosition(); 245 fixedPositionRight(); 246 } 247 248 if( columnX < 0 ){ 249 resetPosition(); 250 fixedPositionLeft(); 251 } 252 } 253 function updateParams(){ 254 columnW = $column.outerWidth(); 255 columnX = $column.offset().left; 256 windowW = $(window).width(); 257 } 258 function resizer(){ 259 var delay; 260 window.clearTimeout(delay);
261 delay = window.setTimeout(function() { 262 setup(); 263 }, 200); 264 } 265 function fixedPositionRight(){ 266 var newPosX = ( windowW - columnW ) - $column.offset().left; 267 $column.css({'left' : newPosX, 'right' : '' }); 268 } 269 function fixedPositionLeft(){ 270 var newPosX = - $column.offset().left; 271 $column.css({'left' : newPosX, 'right' : '' }); 272 } 273 function resetPosition(){ 274 $column.css({'left' : '', 'right' : ''}); 275 } 276 }); 277 } 278 }; 279 280 // SVG Animation 281 EUTHEM.svgAnimation = { 282 init : function(){ 283 if(bodyLoader){ 284 return false; 285 } 286 var $svg = $('.eut-svg-icon'); 287 $svg.each(function(){ 288 var $icon = $(this), 289 duration = $icon.data('duration'), 290 id = $icon.attr('id'), 291 file = $icon.data('file'), 292 myVivus, 293 parentDelay = 0; 294 295 if ( 'svg' !== file.split('.').pop() ) { 296 return false; 297 } 298 299 if( $icon.parents('.eut-element').hasClass('eut-animated-item') ){ 300 parentDelay = $icon.parents('.eut-element').data('delay'); 301 } 302 303 $icon.appear(function() { 304 setTimeout(function () { 305 myVivus = new Vivus( id, { 306 duration : duration, 307 file : file, 308 type: 'async', 309 start : 'inViewport' 310 }); 311 }, parentDelay); 312 },{accX: 0, accY: 0}); 313 }); 314 } 315 }; 316 317 318 319 // # Advanced Hidden Menu 320 // ============================================================================= // 321 EUTHEM.advancedHiddenMenu = { 322 init : function(){ 323 var $header = $('#eut-header'), 324 $mainHeader = $('#eut-main-header'), 325 $menu = $('#eut-main-menu'), 326 $menuEl = $menu.find('.eut-first-level'), 327 $headerEl = $mainHeader.find('.eut-header-elements-wrapper'), 328 $btn = $mainHeader.find('.eut-hidden-menu-btn a'), 329 openHeader = false, 330 hoverDelay; 331 332 if( !$menu.length || !$header.hasClass('eut-advanced-hidden-menu') ) return; 333 334 $mainHeader.on('mouseenter.advancedHidden', function(){ 335 var $that = $(this); 336 if( !openHeader ){ 337 openHeader = true; 338 toggleHeader(); 339 } 340 341 }); 342 343 $mainHeader.on('mouseleave.advancedHidden', function(){ 344 var $that = $(this); 345 if( openHeader ){ 346 openHeader = false;
347 toggleHeader(); 348 } 349 }); 350 351 $btn.on('click.advancedHidden', function(e){ 352 e.preventDefault(); 353 if( !openHeader ){ 354 openHeader = true; 355 toggleHeader(); 356 } else { 357 openHeader = false; 358 toggleHeader(); 359 } 360 }); 361 362 if( isMobile.any() ) { 363 $mainHeader.off('mouseenter.advancedHidden'); 364 $mainHeader.off('mouseleave.advancedHidden'); 365 } 366 367 var itemLength = $menuEl.length -1, 368 startTimer = false, 369 count = -1, 370 counter; 371 372 function toggleHeader(){ 373 if( openHeader ){ 374 clearInterval(hoverDelay); 375 $header.addClass('eut-header-hover'); 376 $menuEl.removeClass('hide'); 377 378 // Show Menu 379 startTimer = true; 380 counter = setInterval(timer, 100); 381 382 } else { 383 hoverDelay = setTimeout(function(){ 384 $header.removeClass('eut-header-hover'); 385 $menuEl.removeClass('show'); 386 $headerEl.removeClass('show'); 387 },400); 388 389 // Hide Menu 390 startTimer = false; 391 count = -1; 392 clearInterval(counter); 393 $header.removeClass('eut-open-menu'); 394 $menuEl.addClass('hide'); 395 } 396 } 397 398 function timer() { 399 count += 1; 400 if (count >= itemLength) { 401 clearInterval(counter); 402 $header.addClass('eut-open-menu'); 403 $headerEl.addClass('show'); 404 } 405 $menuEl.eq(count).addClass('show'); 406 } 407 } 408 }; 409 410 // # Leader Post Size 411 // ============================================================================= // 412 EUTHEM.leaderPostSize = { 413 init : function(){ 414 var $leaderElement = $('.eut-blog-leader.eut-layout-1.eut-crocal-style'); 415 416 if( !$leaderElement.length ) return; 417 418 var windowWidth, 419 maxHeight, 420 leaderHeight; 421 422 $leaderElement.each(function(){ 423 var $this = $(this), 424 $leaderPost = $this.find('.eut-post-leader'), 425 resizing = false; 426 427 428 resetHeight(); 429 $(window).smartresize(resetHeight); 430 431 function resetHeight(){ 432 if(!resizing){ 433 resizing = true; 434 435 $leaderPost.css({ 436 'height' : '' 437 }); 438 439 updateParams(); 440 } 441 } 442 443 function updateParams() { 444 windowWidth = $(window).width(); 445 446 $this.imagesLoaded('always',function(){ 447 maxHeight = $this.outerHeight(); 448 leaderHeight = $leaderPost.outerHeight(); 449 450 setLeaderHeight(); 451 }); 452 } 453 454 function setLeaderHeight(){ 455 if( maxHeight > leaderHeight && windowWidth + scrollBarWidth > tabletPortrait ){ 456 $leaderPost.css({ 457 'height' : maxHeight, 458 'visibility' : 'visible' 459 }); 460 } else { 461 $leaderPost.css({ 462 'visibility' : 'visible' 463 }); 464 } 465 466 resizing = false; 467 } 468 }); 469 } 470 }; 471 472 // # Anchor Menu 473 // ============================================================================= // 474 var openAnchorMenu = false;
475 EUTHEM.anchorMenu = { 476 init: function( anchor ){ 477 var $anchor = $(anchor); 478 if( !$anchor.length ) return; 479 EUTHEM.anchorMenu.resetSticky( anchor ); 480 }, 481 updateSticky: function( $wrapper, topOffset, topPos ){ 482 var scroll = $(window).scrollTop(), 483 sticky = false; 484 485 if( scroll >= topOffset ){ 486 sticky = true; 487 $wrapper 488 .addClass('eut-sticky') 489 .css({'top' : topPos}); 490 } else { 491 sticky = false; 492 $wrapper 493 .removeClass('eut-sticky') 494 .css({'top' : ''}); 495 $wrapper.css(EUTHEM.anchorMenu.doTranslate( 0 )); 496 } 497 }, 498 setOffset: function( anchor ){ 499 var $anchor = $(anchor), 500 anchorT = $anchor.offset().top, 501 $header = $('#eut-header'), 502 stikyType = $header.data('sticky'), 503 headerH = $header.data('sticky-height') !== undefined && stikyType != 'scrollup' && stikyType != 'none' ? $header.data('sticky-height') : 0, 504 frameSize = $('body').hasClass('eut-framed') ? $('#eut-frames').find('.eut-frame.eut-top').height() : 0, 505 offset = 0; 506 507 offset = { 508 topOffset : anchorT - headerH - frameSize, 509 topPos : headerH + frameSize 510 }; 511 return offset; 512 }, 513 resetSticky: function( anchor ){ 514 var $anchor = $(anchor); 515 if( !$anchor.length ) return; 516 var $wrapper = $anchor.children('.eut-anchor-wrapper'), 517 windowW = $(window).width(); 518 519 EUTHEM.anchorMenu.resetResponsive( anchor ); 520 521 if( windowW + scrollBarWidth < 1023 ) { 522 $anchor.addClass('eut-anchor-responsive'); 523 $wrapper.removeClass('eut-sticky'); 524 $wrapper.css(EUTHEM.anchorMenu.doTranslate( 0 )); 525 $(window).off('scroll.eut_anchor'); 526 EUTHEM.anchorMenu.responsive( anchor ); 527 } else { 528 $anchor.removeClass('eut-anchor-responsive'); 529 var topOffset = EUTHEM.anchorMenu.setOffset( anchor ).topOffset, 530 topPos = EUTHEM.anchorMenu.setOffset( anchor ).topPos; 531 $(window).on('scroll.eut_anchor', function(){ 532 EUTHEM.anchorMenu.updateSticky( $wrapper, topOffset, topPos ); 533 }); 534 } 535 }, 536 moveAnchor : function( anchor, position ){ 537 var $anchor = $(anchor), 538 $wrapper = $anchor.children('.eut-anchor-wrapper'); 539 if( $wrapper.hasClass('eut-sticky') ){ 540 $wrapper.css(EUTHEM.anchorMenu.doTranslate( position )); 541 } 542 }, 543 doTranslate : function(value){ 544 return { 545 '-webkit-transform' : 'translate3d(0px, ' + value + 'px, 0px) translateZ(0)', 546 '-moz-transform' : 'translate3d(0px, ' + value + 'px, 0px) translateZ(0)', 547 '-ms-transform' : 'translate3d(0px, ' + value + 'px, 0px) translateZ(0)', 548 '-o-transform' : 'translate3d(0px, ' + value + 'px, 0px) translateZ(0)', 549 'transform' : 'translate3d(0px, ' + value + 'px, 0px) translateZ(0)' 550 }; 551 }, 552 responsive : function( anchor ){ 553 var $anchor = $(anchor), 554 $btn = $anchor.find('.eut-anchor-btn'), 555 $menu = $anchor.find('.menu'), 556 $menuLink = $menu.find('a'); 557 558 $btn.on('click',function(e){ 559 e.preventDefault(); 560 if(openAnchorMenu){ 561 $anchor.css({'height' : ''}); 562 $menu.slideUp(function(){ 563 openAnchorMenu = false;
564 $(this).removeAttr('style'); 565 }); 566 } else { 567 $anchor.css({'height' : 'auto'}); 568 $menu.slideDown(function(){ 569 openAnchorMenu = true; 570 }); 571 } 572 }); 573 }, 574 resetResponsive: function( anchor ){ 575 var $anchor = $(anchor), 576 $menu = $anchor.find('.menu'); 577 $menu.removeAttr('style'); 578 openAnchorMenu = false; 579 } 580 }; 581 582 // # Menu Slide or Toggle 583 // ============================================================================= // 584 EUTHEM.slideToggleMenu = { 585 586 init: function( parrent, element ){ 587 588 $(element).each(function(){ 589 if( !$(this).length ) return; 590 591 var $menu = $(this), 592 $menuParent = $menu.parents(parrent), 593 $menuItem = $menu.find('li.menu-item-has-children > a'), 594 menuType = $menuParent.hasClass('eut-slide-menu') ? 'slide' : 'toggle', 595 $arrow = $('<i class="eut-arrow"></i>'), 596 $goBack = $('<li class="eut-goback"><a href="#" aria-label="' + crocal_eutf_main_data.string_go_back + '"><i class="eut-arrow"></i></a></li>'); 597 598 EUTHEM.slideToggleMenu.removeHiddenMenuItems( $menu ); 599 600 if( menuType === 'slide' ) { 601 // Add Arrows 602 $arrow.appendTo( $menuItem.parent() ); 603 // Add Go Back Button for Slide Menu 604 $goBack.prependTo( $menuItem.parent().find('>ul') ); 605 } else { 606 // Add Arrows 607 $arrow.appendTo( $menuItem ); 608 } 609 610 $menuItem.on('tap click',function(e){ 611 var $this = $(this), 612 link = $this.attr('href'), 613 open = false; 614 615 if((link != '#' || link === '#') && menuType == 'toggle' ) { 616 if( !$this.parent().hasClass('open') && !open ) { 617 e.preventDefault(); 618 $this.parent().addClass('open'); 619 toggle( $this, open ); 620 } else { 621 open = true; 622 toggle( $this, open ); 623 $this.parent().removeClass('open'); 624 } 625 } else if( link === '#' && menuType == 'slide' ) { 626 e.preventDefault(); 627 var listLevel = $this.parents('ul').length, 628 $firstItem = $this.parent().find('ul').first(), 629 menuOffset = $menu.offset().top, 630 offset = $this.offset().top, 631 title = $this.html(); 632 633 appendTitle( title, $firstItem ); 634 635 $firstItem.addClass('show').css({ 'top' : - ( offset - menuOffset ) }); 636 var firstItemH = $firstItem.outerHeight(); 637 638 if( $('body').hasClass('rtl') ) { 639 animRightMenu( firstItemH, listLevel ); 640 } else { 641 animLeftMenu( firstItemH, listLevel ); 642 } 643 } 644 }); 645 646 if( menuType === 'slide' ) { 647 var $arrowBtn = $menuItem.parent().find('.eut-arrow'); 648 $arrowBtn.on('click',function(){ 649 var $this = $(this), 650 listLevel = $this.parents('ul').length, 651 $firstItem = $this.parent().find('ul').first(), 652 menuOffset = $menu.offset().top, 653 offset = $this.offset().top, 654 title = $this.parent().find('a').first().html(); 655 656 appendTitle( title, $firstItem ); 657 658 $firstItem.addClass('show').css({ 'top' : - ( offset - menuOffset ) }); 659 var firstItemH = $firstItem.outerHeight(); 660 661 if( $('body').hasClass('rtl') ) { 662 animRightMenu( firstItemH, listLevel ); 663 } else { 664 animLeftMenu( firstItemH, listLevel ); 665 } 666 667 }); 668 } 669 670 $('li.eut-goback a').on('click', function(e) { 671 e.preventDefault(); 672 var listLevel = $(this).parents('ul ul').length - 1, 673 $firstItem = $(this).closest('.sub-menu'), 674 firstItemH = $firstItem.closest('.menu-item-has-children').closest('ul').height(); 675 676 setTimeout(function(){ 677 $firstItem.removeClass('show'); 678 },300); 679 if( $('body').hasClass('rtl') ) { 680 animRightMenu( firstItemH, listLevel ); 681 } else { 682 animLeftMenu( firstItemH, listLevel ); 683 } 684 }); 685 686 function toggle( $this, open ){ 687 var $subMenu = $this.parent().find('>ul'); 688 if( open ) { 689 $subMenu.slideUp(200); 690 } else { 691 $subMenu.slideDown(200); 692 } 693 } 694 695 function animLeftMenu( height, listLevel ) { 696 $menu.parent().height(height); 697 $menu.css('transform', 'translate3d(' + - listLevel * 100 + '%,0,0)'); 698 } 699 700 function animRightMenu( height, listLevel ) { 701 $menu.parent().height(height); 702 $menu.css('transform', 'translate3d(' + listLevel * 100 + '%,0,0)'); 703 } 704 705 function appendTitle( title, list ){ 706 if( list.find('.eut-goback .eut-item').length ) return; 707 $(title).appendTo( list.find('> .eut-goback a') ); 708 } 709 }); 710 }, 711 removeHiddenMenuItems: function( $menu ){
712 var $hiddenMenuItem = $menu.find('li.eut-hidden-menu-item'), 713 $link = $hiddenMenuItem.find('>a'), 714 $subMenu = $hiddenMenuItem.find('>.sub-menu'); 715 716 $link.remove(); 717 $subMenu.unwrap().children().unwrap(); 718 } 719 720 }; 721 722 // # Sticky Sidebar Widget 723 // ============================================================================= // 724 EUTHEM.stickySidebarWidget = { 725 init: function(){ 726 727 var $stickyWidget = $('#eut-content .eut-sticky-widget'), 728 sidebarWidget = false; 729 730 $stickyWidget.each(function(){ 731 var $this = $(this); 732 733 if( $this.length > 0 ) { 734 735 if( $('.eut-sticky-widget').parent().parent().is('#eut-sidebar') ) { 736 sidebarWidget = true; 737 } 738 739 if( sidebarWidget && $('#eut-sidebar').hasClass('eut-fixed-sidebar') ) return; 740 741 var $content = sidebarWidget ? $('#eut-main-content .eut-main-content-wrapper') : $this.parents('.eut-row'), 742 $sidebar = $this.parent(), 743 headerHeight = $('#eut-header').data('sticky') != 'none' ? $('#eut-header').data('sticky-height') : 0, 744 anchorHeight = $('.eut-anchor-menu').length ? $('.eut-anchor-menu').outerHeight() : 0, 745 topOffset = headerHeight + anchorHeight + 40; 746 747 var windowWidth,sidebarWidth,sidebarHeight,contentTop,contentPadding,sidebarTop; 748 749 var scrolling = false, 750 sidebarAnimation = false, 751 resizing = false; 752 753 updateParams(); 754 755 if( windowWidth + scrollBarWidth > tabletPortrait ) { 756 $(window).on('scroll', checkSidebar); 757 } 758 $(window).smartresize(resetScroll); 759 760 } 761 762 function checkSidebar() { 763 if( !sidebarAnimation ) { 764 sidebarAnimation = true; 765 updateSidebarPosition(); 766 } 767 } 768 769 function resetScroll() { 770 if( !resizing ) { 771 resizing = true; 772 $sidebar.removeClass('fixed').attr('style', ''); 773 updateParams(); 774 } 775 } 776 777 function updateParams() { 778 windowWidth = $(window).width(); 779 sidebarWidth = $sidebar.width(); 780 sidebarHeight = $sidebar.height(); 781 contentTop = $content.offset().top; 782 contentPadding = parseInt( $content.css('padding-top') ); 783 sidebarTop = $this.offset().top; 784 785 $(window).off('scroll', checkSidebar); 786 787 if( windowWidth + scrollBarWidth > tabletPortrait ) { 788 $(window).on('scroll', checkSidebar); 789 } 790 resizing = false; 791 } 792 793 function updateSidebarPosition() { 794 var contentHeight = $content.height(), 795 scrollTop = $(window).scrollTop(), 796 topPosition = sidebarTop - contentTop - topOffset - contentPadding; 797 798 if( scrollTop < sidebarTop - topOffset ) { 799 $sidebar.removeClass('fixed').attr('style', ''); 800 } else if( scrollTop >= sidebarTop - topOffset && scrollTop < sidebarTop + contentHeight - sidebarHeight - topOffset ) { 801 $sidebar.addClass('fixed').css({ 'top' : - topPosition, 'position' : 'fixed', 'width' : sidebarWidth }); 802 } else { 803 if( $sidebar.hasClass('fixed') ) { 804 $sidebar.removeClass('fixed').css({ 'top' : contentHeight - sidebarHeight + 'px', 'position' : 'relative' }); 805 } 806 } 807 sidebarAnimation = false; 808 } 809 }); 810 } 811 }; 812 813 // # Sticky Sidebar 814 // ============================================================================= // 815 EUTHEM.stickySidebar = { 816 init: function(){ 817 818 var $sidebar = $('#eut-sidebar'); 819 if( $sidebar.length > 0 && $sidebar.hasClass('eut-fixed-sidebar') ) { 820 821 var $content = $('#eut-main-content .eut-main-content-wrapper'), 822 $sidebarWrapper = $sidebar.find('.eut-wrapper'), 823 headerHeight = $('#eut-header').data('sticky') != 'none' ? $('#eut-header').data('sticky-height') : 0, 824 anchorHeight = $('.eut-anchor-menu').length ? $('.eut-anchor-menu').outerHeight() : 0, 825 topOffset = headerHeight + anchorHeight + 100, 826 bottomOffset = 0; 827 828 var windowWidth,sidebarWidth,sidebarHeight,contentPadding,sidebarTop; 829 830 var scrolling = false, 831 sidebarAnimation = false, 832 resizing = false; 833 834 updateParams(); 835 836 if( windowWidth + scrollBarWidth > tabletPortrait ) { 837 $(window).on('scroll', checkSidebar); 838 } 839 840 $(window).smartresize(resetScroll); 841 } 842 843 function checkSidebar() { 844 if( !sidebarAnimation ) { 845 sidebarAnimation = true; 846 updateSidebarPosition(); 847 } 848 } 849 850 function resetScroll() { 851 if( !resizing ) { 852 resizing = true; 853 $sidebarWrapper.removeClass('fixed').attr('style', ''); 854 updateParams(); 855 } 856 } 857 858 function updateParams() { 859 windowWidth = $(window).width(); 860 sidebarWidth = $sidebar.width(); 861 sidebarHeight = $sidebar.height(); 862 contentPadding = parseInt( $content.css('padding-top') ); 863 sidebarTop = $sidebar.offset().top; 864 865 if( $('.eut-navigation-bar').length ) { 866 bottomOffset = $('.eut-navigation-bar').outerHeight() + 60; 867 } 868 869 $(window).off('scroll', checkSidebar); 870 871 if( windowWidth + scrollBarWidth > tabletPortrait ) { 872 checkSidebar(); 873 $(window).on('scroll', checkSidebar); 874 } 875 876 $sidebar.css({ 877 'visibility' : 'visible' 878 }); 879 880 resizing = false;
881 } 882 883 function updateSidebarPosition() { 884 var contentHeight = $content.height(), 885 scrollTop = $(window).scrollTop(); 886 887 if( scrollTop < sidebarTop - topOffset + contentPadding ) { 888 $sidebarWrapper.removeClass('fixed').attr('style', ''); 889 } else if( scrollTop >= sidebarTop - topOffset + contentPadding && scrollTop < sidebarTop + contentHeight - sidebarHeight - topOffset + contentPadding - bottomOffset ) { 890 $sidebarWrapper.addClass('fixed').css({ 'top' : topOffset, 'position' : 'fixed', 'width' : sidebarWidth }); 891 } else { 892 if( $sidebarWrapper.hasClass('fixed') ) { 893 $sidebarWrapper.removeClass('fixed').css({ 'top' : contentHeight - sidebarHeight - bottomOffset + 'px', 'position' : 'relative' }); 894 } 895 } 896 sidebarAnimation = false; 897 } 898 899 } 900 }; 901 902 // # Set Feature Section Size 903 // ============================================================================= // 904 EUTHEM.featureSize = { 905 init: function( section ){ 906 if( !$(section).length ) return; 907 var $section = $(section); 908 if( $section.hasClass('eut-fullscreen') ) { 909 this.fullscreenSize( $section ); 910 } else if( $section.hasClass('eut-custom-size') ) { 911 this.customSize( $section ); 912 } 913 }, 914 getTopBarHeight : function( topBar ){ 915 var height = 0, 916 $topBar = $(topBar); 917 if( $topBar.length ) { 918 height = $topBar.outerHeight(); 919 } 920 return height; 921 }, 922 getHeaderHeight : function( header, responsiveHeader ){ 923 var height = 0, 924 $header = $(header), 925 $resHeader = $(responsiveHeader); 926 if( $header.length && $header.is(':visible') && !$header.hasClass('eut-overlapping') && !$header.hasClass('eut-header-below') ) { 927 height = $header.outerHeight(); 928 } 929 if( $resHeader.length && $resHeader.is(':visible') && !$header.hasClass('eut-responsive-overlapping') && !$header.hasClass('eut-header-below') ) { 930 height = $resHeader.outerHeight(); 931 } 932 return height; 933 }, 934 fullscreenSize : function( $section ){ 935 var windowH = $(window).height(), 936 headerH = this.getHeaderHeight( '#eut-header', '#eut-responsive-header' ), 937 topBarH = this.getTopBarHeight( '#eut-top-bar' ), 938 frameSize = $('body').hasClass('eut-framed') ? $('#eut-frames').find('.eut-frame.eut-top').height() : 0, 939 sectionH = windowH - headerH - topBarH - (frameSize * 2); 940 $section.css( 'height', sectionH).find('.eut-wrapper').css( 'height', sectionH); 941 }, 942 customSize : function( $section ){ 943 var windowH = $(window).height(), 944 initHeight = $section.data('height'), 945 newHeight = ((windowH * initHeight) / 100); 946 if( newHeight > this.windowH ) { 947 newHeight = this.windowH; 948 } 949 $section.css( 'height', newHeight).find('.eut-wrapper').css( 'height', newHeight); 950 } 951 }; 952 953 // # Feature Section 954 // ============================================================================= // 955 EUTHEM.featureSection = { 956 init : function(section){ 957 if( !section.length ) return; 958 var $section = $(section), 959 $bgImage = $section.find('.eut-bg-image'), 960 $bgVideo = $section.find('.eut-bg-video'), 961 $spinner = $(spinner), 962 animateContent = false; 963 964 // Set Size 965 EUTHEM.featureSize.init( section ); 966 967 if( $bgImage.length ) { 968 // Load Background Images 969 loadFeatureImage(); 970 } else if( !$bgImage.length && $bgVideo.length ) { 971 showFeature(); 972 } else { 973 // Play Animation Content 974 featureAnimation( $section ); 975 } 976 977 // Load Background Images 978 function loadFeatureImage(){ 979 var totalBgImage = $bgImage.length, 980 waitImgDone = function() { 981 totalBgImage--; 982 if (!totalBgImage) { 983 showFeature(); 984 } 985 }; 986 $bgImage.each(function () { 987 function imageUrl(input) { 988 return input.replace(/"/g,"").replace(/url\(|\)$/ig, ""); 989 } 990 var image = new Image(), 991 $that = $(this); 992 image.src = imageUrl($that.css('background-image')); 993 $(image).on('load',waitImgDone).on( "error", waitImgDone ); 994 }); 995 } 996 997 // Add Spinner 998 function addSpinner(){ 999 $spinner.appendTo( $section ); 1000 $section.addClass('eut-with-spinner'); 1001 } 1002 1003 // Remove Spinner 1004 function removeSpinner(){ 1005 $spinner.fadeOut(900,function(){ 1006 $spinner.remove(); 1007 // Show Feature Section 1008 showFeature(); 1009 }); 1010 } 1011 1012 // Show Feature Section 1013 function showFeature(){ 1014 var $overlay = $section.find('.eut-bg-overlay'), 1015 $content = $section.find('.eut-content'), 1016 $bgImage = $section.find('.eut-bg-image'), 1017 $bgVideo = $section.find('.eut-bg-video'); 1018 1019 $bgImage.addClass('show'); 1020 $bgVideo.addClass('show'); 1021 $overlay.addClass('show'); 1022 1023 animateContent = true; 1024 if( $section.hasClass('eut-with-slider') ) { 1025 // Init Feature Slider 1026 featureSlider(); 1027 } else { 1028 // Play Feature Animation 1029 featureAnimation( $section ); 1030 } 1031 } 1032 1033 // Feature Slider 1034 function featureSlider(){ 1035 var $slider = $('#eut-feature-slider'),
1036 pauseHover = $slider.attr('data-slider-pause') == 'yes' ? true : '', 1037 sliderSpeed = parseInt( $slider.attr('data-slider-speed') ) ? parseInt( $slider.attr('data-slider-speed') ) : 6000, 1038 transition = $slider.attr('data-slider-transition'), 1039 slidersLength = $slider.find('.eut-slider-item').length, 1040 pagination = $slider.attr('data-pagination') != 'no' ? true : false, 1041 $nextNav = $slider.parent().find('.eut-carousel-next'), 1042 $prevNav = $slider.parent().find('.eut-carousel-prev'), 1043 loop = true, 1044 animateOut = false, 1045 animateIn = false, 1046 stopSlider = false; 1047 1048 // Slider Trantition 1049 if( transition != 'slide' ){ 1050 animateOut = 'carousel-' + transition + '-out'; 1051 animateIn = 'carousel-' + transition + '-in'; 1052 } 1053 1054 EUTHEM.featureSection.addPaginationNumbers(); 1055 1056 1057 $slider.on('initialized.owl.carousel changed.owl.carousel',function(event){ 1058 var current = event.item.index !== null ? event.item.index : 0, 1059 $currentSlide = $(event.target).find('.eut-slider-item').eq(current), 1060 sliderColor = $currentSlide.attr('data-header-color'), 1061 color = 'eut-' + sliderColor; 1062 1063 if( !$currentSlide.length) return; 1064 1065 // Slider Animation 1066 featureAnimation( $currentSlide ); 1067 1068 EUTHEM.featureSection.getActiveNumber( current ); 1069 1070 // Set Header Color 1071 if( !$('#eut-main-header').hasClass('eut-header-side') ) { 1072 $('#eut-main-header').removeClass('eut-light eut-dark').addClass(color); 1073 } 1074 1075 // Set Navigation Color 1076 $('#eut-feature-slider').removeClass('eut-light eut-dark eut-default').addClass(color); 1077 $('#eut-feature-section .eut-carousel-navigation').removeClass('eut-light eut-dark eut-default').addClass(color); 1078 $('#eut-feature-section .eut-carousel-pagination').removeClass('eut-light eut-dark eut-default').addClass(color); 1079 1080 $('#eut-feature-section .eut-slider-numbers').removeClass('eut-light eut-dark eut-default').addClass(color); 1081 }); 1082 1083 if ( $slider.find('.eut-slider-item').length == 1 ) { 1084 loop = false; 1085 } 1086 1087 $slider.owlCarousel({ 1088 items : 1, 1089 loop : loop, 1090 autoplay : true, 1091 autoplayTimeout : sliderSpeed, 1092 autoplayHoverPause : pauseHover, 1093 smartSpeed : 500, 1094 dots : pagination, 1095 dotsClass : 'eut-carousel-pagination', 1096 animateOut : animateOut, 1097 animateIn : animateIn, 1098 responsiveClass : false, 1099 itemClass : 'eut-slider-item-wrapper' 1100 }); 1101 1102 $(window).on('scroll',autoplayHandler); 1103 1104 function autoplayHandler(){ 1105 var scroll = $(window).scrollTop(); 1106 if( scroll > 300 && !stopSlider ){ 1107 stopSlider = true; 1108 $slider.trigger('stop.owl.autoplay'); 1109 } else if( scroll < 300 && stopSlider ) { 1110 stopSlider = false;
1111 $slider.trigger('play.owl.autoplay'); 1112 } 1113 } 1114 1115 // Go to the next item 1116 $nextNav.on( 'click', function() { 1117 $slider.trigger('next.owl.carousel'); 1118 }); 1119 // Go to the previous item 1120 $prevNav.on( 'click', function() { 1121 $slider.trigger('prev.owl.carousel'); 1122 }); 1123 } 1124 1125 // Feature Animation 1126 function featureAnimation(section){ 1127 var $section = section, 1128 $wrapper = $section.find('.eut-title-content-wrapper'), 1129 effect = $section.find('.eut-content').data('animation'), 1130 effectClass = 'eut-animate-' + effect, 1131 delay = 200, 1132 cnt = 0, 1133 contentItems = { 1134 graphic : $section.find(' .eut-graphic '), 1135 subheading : $section.find(' .eut-subheading '), 1136 title : $section.find(' .eut-title '), 1137 description : $section.find(' .eut-description '), 1138 titleMeta : $section.find(' .eut-title-meta-content '), 1139 button1 : $section.find(' .eut-btn-1 '), 1140 button2 : $section.find(' .eut-btn-2 '), 1141 gotoArrow : $section.find(' .eut-goto-section-wrapper ') 1142 }; 1143 1144 // Show Content 1145 $section.find('.eut-content').addClass('show'); 1146 1147 if( !$wrapper.hasClass('eut-bg-none') ){ 1148 contentItems = $wrapper; 1149 } 1150 1151 // Add Animation Class 1152 $.each( contentItems, function( key, item ) { 1153 $(item).removeClass('eut-animate-fade-in eut-animate-fade-in-up eut-animate-fade-in-down eut-animate-fade-in-left eut-animate-fade-in-right eut-animate-zoom-in eut-animate-zoom-out'); 1154 1155 if( $(item).length ){ 1156 cnt++; 1157 if( effect != 'none' ){ 1158 setTimeout(function(){ 1159 $(item).addClass( effectClass ); 1160 },cnt * delay); 1161 } 1162 } 1163 }); 1164 } 1165 }, 1166 addPaginationNumbers: function(){ 1167 var $slider = $('#eut-feature-slider'), 1168 $sliderItems = $slider.find('.eut-slider-item'), 1169 $list = $slider.parent().find('.eut-slider-numbers'), 1170 sliderSpeed = parseInt( $slider.attr('data-slider-speed') ) ? parseInt( $slider.attr('data-slider-speed') ) : 6000; 1171 1172 if( $list.length > 0 ) { 1173 $list.appendTo( $slider.parent() ); 1174 $sliderItems.each(function(num,item){ 1175 var number = (num + 1) < 10 ? '0' + (num + 1) : num + 1, 1176 $listIem = $('<li class="eut-link-text">' + number +'</li>'); 1177 $listIem.appendTo( $list ); 1178 }); 1179 1180 $list.find('li').on('click',function(){ 1181 var $that = $(this), 1182 goTo = $that.index(), 1183 timer; 1184 $slider.trigger('to.owl.carousel', [goTo, 300]); 1185 $slider.trigger('stop.owl.autoplay'); 1186 $that.addClass('active').siblings().removeClass('active'); 1187 clearTimeout(timer); 1188 timer = setTimeout(function(){ 1189 $slider.trigger('play.owl.autoplay'); 1190 },sliderSpeed); 1191 }); 1192 } 1193 }, 1194 getActiveNumber: function( currentSlider ){ 1195 var $slider = $('#eut-feature-slider'), 1196 $list = $slider.parent().find('.eut-slider-numbers'), 1197 $listIem = $list.find('li'); 1198 if( $list.length > 0 ) { 1199 var currentNumber = currentSlider - 2 <= 0 ? 0 : currentSlider - 2; 1200 $listIem.eq(currentNumber).addClass('active').siblings().removeClass('active'); 1201 } 1202 } 1203 }; 1204 1205 // # Feature Parallax 1206 // ============================================================================= // 1207 var featureParallaxScroll = false; 1208 EUTHEM.featureParallax = { 1209 init: function(){ 1210 var section = $('#eut-feature-section'), 1211 scroll = false, 1212 smallDelay; 1213 1214 if( !section.hasClass('eut-bg-parallax') && !section.hasClass('eut-bg-advanced-parallax') && !section.hasClass('eut-bg-fixed-section') ) { 1215 return; 1216 } 1217 1218 // Create Parallax Wrapper 1219 section.children().wrapAll('<div class="eut-feature-inner"><div class="eut-parallax-wrapper"></div></div>'); 1220 1221 updateParallax(); 1222 1223 // Add window events 1224 $(window).on('resize', function(){ 1225 window.clearTimeout(smallDelay); 1226 smallDelay = window.setTimeout(function () { 1227 updateParallax(); 1228 }, 100); 1229 }); 1230 $(window).on('scroll', onWindowScroll); 1231 1232 function onWindowScroll(){ 1233 if( window.requestAnimationFrame ) { 1234 if(!scroll){ 1235 window.requestAnimationFrame( updateParallax ); 1236 scroll = true; 1237 } 1238 } else { 1239 updateParallax(); 1240 } 1241 } 1242 1243 function updateParallax(){ 1244 var wrapper = section.find('.eut-parallax-wrapper'); 1245 var parallaxType; 1246 if( section.hasClass('eut-bg-advanced-parallax') ){ 1247 parallaxType = 'advanced'; 1248 } else if( section.hasClass('eut-bg-fixed-section') ){ 1249 parallaxType = 'fixed'; 1250 } else { 1251 parallaxType = 'classic'; 1252 } 1253 1254 if( inViewport( section ) ){ 1255 // References 1256 var scrollTop = $( window ).scrollTop(); 1257 var sectionTop = section.offset().top; 1258 var sectionW = section.outerWidth(); 1259 var sectionH = section.outerHeight(); 1260 var position = scrollTop * 0.2; 1261 var elementH = sectionH + sectionTop; 1262 var opacity = ( ( ( sectionH + sectionTop ) - scrollTop ) / sectionH ).toFixed(2); 1263 var scale = ( ( ( sectionH + sectionTop ) + scrollTop ) / sectionH ); 1264 var content = section.find('.eut-wrapper, .eut-background-wrapper'); 1265 var bgImage = section.find('.eut-bg-image'); 1266 if( tSupport ){ 1267 1268 if( parallaxType == 'advanced' ) { 1269 wrapper.css({ 1270 'position' : 'fixed', 1271 'top' : sectionTop, 1272 'height' : elementH, 1273 'width' : sectionW, 1274 transform: 'translate3d( 0px' + ', ' + -position + 'px' + ', 0px) translateZ(0)', 1275 visibility: 'visible' 1276 }); 1277 } else if( parallaxType == 'fixed' ) { 1278 wrapper.css({ 1279 'position' : 'fixed', 1280 'top' : sectionTop, 1281 'height' : elementH, 1282 'width' : sectionW, 1283 visibility: 'visible' 1284 }); 1285 } else { 1286 wrapper.css({ 1287 'position' : 'relative', 1288 'height' : elementH, 1289 'width' : sectionW, 1290 transform: 'translate3d( 0px' + ', ' + position + 'px' + ', 0px) translateZ(0)', 1291 visibility: 'visible' 1292 }); 1293 } 1294 1295 bgImage.css({visibility: 'visible'}); 1296 } 1297 } else { 1298 wrapper.css({ 1299 'position' : 'relative' 1300 }); 1301 } 1302 scroll = false;
1303 } 1304 1305 function inViewport( element ){ 1306 var winTop = $( window ).scrollTop(); 1307 var winBottom = winTop + $( window ).height(); 1308 var elTop = element.offset().top; 1309 var elBottom = elTop + element.outerHeight(); 1310 return ( winBottom >= elTop && winTop <= elBottom ); 1311 } 1312 1313 } 1314 }; 1315 1316 // # Woocommerce Carousel Thumb Gallery 1317 // ============================================================================= // 1318 EUTHEM.wooThumbCarousel = { 1319 init : function(){ 1320 var $thumbs = $('#eut-product-feature-image').find('.thumbnails'), 1321 $thumbsWrapper = $thumbs.find('.eut-thumbnails-wrapper'), 1322 $thumbsInner = $thumbs.find('.eut-thumbnails-inner'), 1323 $items = $thumbs.find('.eut-thumb-item'), 1324 $arrowPrev = $('<i class="eut-icon-nav-up-small eut-arrow-prev"></i>'), 1325 $arrowNext = $('<i class="eut-icon-nav-down-small eut-arrow-next"></i>'), 1326 wrapper = false, 1327 smallDelay, 1328 wrapperH, 1329 slidesLength, 1330 cnt; 1331 1332 1333 if( !$thumbs.length || $items.length <= 4 ) { 1334 $thumbsWrapper.css({ 1335 'visibility' : 'visible' 1336 }); 1337 return false; 1338 } 1339 1340 setSlider(); 1341 $(window).on('resize', function(){ 1342 window.clearTimeout(smallDelay); 1343 smallDelay = window.setTimeout(function () { 1344 setSlider(); 1345 }, 300); 1346 }); 1347 1348 function addWrapper(){ 1349 if( !wrapper ) { 1350 for (var i = 0, len = $items.length; i < len; i += 4) { 1351 $items.slice(i, i + 4).wrapAll('<div class="eut-thumb-wrapper"/>'); 1352 } 1353 1354 wrapperH = $('.eut-thumb-wrapper').first().outerHeight(); 1355 slidesLength = $('.eut-thumb-wrapper').length - 1; 1356 1357 $thumbsWrapper.css({ 1358 'height' : wrapperH, 1359 'overflow' : 'hidden', 1360 'visibility' : 'visible' 1361 }); 1362 1363 addArrows(); 1364 $thumbsInner.addClass('eut-with-transition'); 1365 1366 wrapper = true; 1367 } 1368 } 1369 1370 function addArrows(){ 1371 $arrowPrev.appendTo( $thumbs ); 1372 $arrowNext.appendTo( $thumbs ); 1373 // Add Classes 1374 $arrowPrev.addClass('eut-disable-arrow'); 1375 $arrowNext.removeClass('eut-disable-arrow'); 1376 1377 cnt = 0; 1378 bindEvents(); 1379 } 1380 1381 function moveSlide(n){ 1382 $thumbsInner.css( doTranslate( n * wrapperH ) ); 1383 } 1384 1385 function setSlider(){ 1386 if( $(window).width() + scrollBarWidth < tabletPortrait && wrapper) { 1387 resetSlider(); 1388 } else if( $(window).width() + scrollBarWidth > tabletPortrait && !wrapper) { 1389 addWrapper(); 1390 } 1391 } 1392 1393 function resetSlider(){ 1394 $thumbsInner.removeClass('eut-with-transition'); 1395 $thumbsInner.css( doTranslate( 0 ) ); 1396 $items.unwrap(); 1397 $thumbsWrapper.css({ 1398 'height' : '', 1399 'overflow' : 'visible', 1400 'visibility' : 'visible' 1401 }); 1402 1403 $arrowPrev.remove(); 1404 $arrowNext.remove(); 1405 1406 wrapper = false;
1407 } 1408 1409 function bindEvents(){ 1410 $arrowNext.on('click.thumb-arrows',function(){ 1411 var $that = $(this); 1412 if( cnt > - slidesLength ){ 1413 cnt--; 1414 moveSlide( cnt ); 1415 $arrowPrev.removeClass('eut-disable-arrow'); 1416 } 1417 if(cnt == -slidesLength ){ 1418 $that.addClass('eut-disable-arrow'); 1419 } 1420 }); 1421 1422 $arrowPrev.on('click.thumb-arrows',function(){ 1423 var $that = $(this); 1424 if( cnt < 0 ){ 1425 cnt++; 1426 moveSlide( cnt ); 1427 $arrowNext.removeClass('eut-disable-arrow'); 1428 } 1429 if(cnt === 0 ){ 1430 $that.addClass('eut-disable-arrow'); 1431 } 1432 }); 1433 } 1434 1435 function doTranslate( value ){ 1436 return { 1437 '-webkit-transform' : 'translate3d(0px, ' + value + 'px, 0px) translateZ(0)', 1438 '-moz-transform' : 'translate3d(0px, ' + value + 'px, 0px) translateZ(0)', 1439 '-ms-transform' : 'translate3d(0px, ' + value + 'px, 0px) translateZ(0)', 1440 '-o-transform' : 'translate3d(0px, ' + value + 'px, 0px) translateZ(0)', 1441 'transform' : 'translate3d(0px, ' + value + 'px, 0px) translateZ(0)' 1442 }; 1443 } 1444 } 1445 }; 1446 1447 // # Woocommerce Product Rating 1448 // ============================================================================= // 1449 EUTHEM.wooProductRating = { 1450 init : function(){ 1451 if ( typeof wc_single_product_params !== 'undefined' ) { 1452 var $rating = $( '.woocommerce-Reviews #respond' ).find( '#rating' ); 1453 if ( $rating.length > 0 && wc_single_product_params.review_rating_required === 'no' ) { 1454 $('.woocommerce-Reviews #respond #rating').removeAttr('required'); 1455 } 1456 } 1457 } 1458 }; 1459 1460 // # Page Settings 1461 // ============================================================================= // 1462 EUTHEM.pageSettings = { 1463 1464 init: function(){ 1465 this.opacityScroll(); 1466 this.changeOrder(); 1467 this.mainMenu(); 1468 this.setClippingWrappers(); 1469 this.setAppearWrappers(); 1470 this.stickyHeader(); 1471 this.responsiveStickyHeader(); 1472 this.eutModal(); 1473 this.gotoFirstSection(); 1474 this.bgLoader(); 1475 this.fitVid(); 1476 this.hiddenArea(); 1477 this.sideArea(); 1478 this.backtoTop(); 1479 this.animatedBg(); 1480 this.onePageSettings(); 1481 this.socialShareLinks(); 1482 this.productImageParallax(); 1483 this.lightBox(); 1484 this.showList(); 1485 this.fixedFooter(); 1486 }, 1487 opacityScroll: function(){ 1488 var $bgImage = $('.eut-bg-scroll-effect'); 1489 $bgImage.each(function(){ 1490 var $that = $(this), 1491 offset = $that.data('opacity-offset') / 100, 1492 initialOpacity = $that.data('initial-opacity') / 100, 1493 finalOpacity = $that.data('final-opacity') / 100, 1494 invert = $that.data('initial-opacity') > $that.data('final-opacity') ? false : true; 1495 1496 $(window).on('scroll', function () { 1497 var scrollTop = invert ? ($(window).scrollTop() + $(window).height()) - $that.offset().top : $(window).scrollTop() - $that.offset().top, 1498 scroll = scrollTop / ( $that.outerHeight() * offset ), 1499 opacity = initialOpacity + ( scroll * ( finalOpacity - initialOpacity ) ); 1500 opacity = opacity.toFixed(2); 1501 if ( invert ) { 1502 if( opacity >= finalOpacity ) { opacity = finalOpacity; } 1503 if( opacity <= initialOpacity ) { opacity = initialOpacity ;} 1504 } else { 1505 if( opacity <= finalOpacity ) { opacity = finalOpacity; } 1506 if( opacity >= initialOpacity ) { opacity = initialOpacity; } 1507 } 1508 $that.css({ 'opacity': opacity }); 1509 }); 1510 }); 1511 }, 1512 setClippingWrappers: function(){ 1513 var $element = $('.eut-clipping-animation'), 1514 wrapper = '<div class="eut-clipping-wrapper"><div class="eut-clipping-content"></div></div>'; 1515 if( isMobile.any() && !deviceAnimAppear ) { 1516 $element.removeClass('eut-clipping-animation'); 1517 } else { 1518 $element.wrapInner( wrapper ); 1519 $element.each(function(){ 1520 var $that = $(this), 1521 $wrapper = $that.find('.eut-clipping-wrapper'); 1522 if( $that.hasClass('eut-colored-clipping') ) { 1523 var color = $that.data('clipping-color'), 1524 overlay = '<div class="eut-clipping-overlay eut-bg-' + color + '"></div>'; 1525 $(overlay).appendTo( $wrapper ); 1526 } 1527 }); 1528 this.clippingAppear(); 1529 } 1530 }, 1531 setAppearWrappers: function(){ 1532 var $element = $('.eut-appear-animation'), 1533 wrapper = '<div class="eut-appear-wrapper eut-animation-wrapper"><div class="eut-appear-content"></div></div>'; 1534 if( isMobile.any() && !deviceAnimAppear ) { 1535 $element.removeClass('eut-appear-animation'); 1536 } else { 1537 $element.wrapInner( wrapper ); 1538 this.animAppear(); 1539 } 1540 }, 1541 animAppear: function(){ 1542 var $animationItem = $('.eut-appear-animation'); 1543 1544 if( bodyLoader || $('body').hasClass('page-template-template-full-page') || $('body').hasClass('page-template-template-pilling-page') ){ 1545 return; 1546 } 1547 if( isMobile.any() && !deviceAnimAppear ) { 1548 $animationItem.removeClass('eut-appear-animation'); 1549 } else { 1550 $animationItem.each(function() { 1551 var $that = $(this),
1552 timeDelay = $that.attr('data-delay'); 1553 1554 $that.appear(function() { 1555 setTimeout(function () { 1556 $that.addClass('eut-appear-animated'); 1557 }, timeDelay); 1558 },{accX: 0, accY: -150}); 1559 }); 1560 } 1561 }, 1562 clippingAppear: function(){ 1563 var $clippingEl = $('.eut-clipping-animation'); 1564 if( bodyLoader || $('body').hasClass('page-template-template-full-page') || $('body').hasClass('page-template-template-pilling-page') ){ 1565 return; 1566 } 1567 if( isMobile.any() && !deviceAnimAppear ) { 1568 $clippingEl.removeClass('eut-clipping-animation'); 1569 } else { 1570 $clippingEl.each(function() { 1571 var $that = $(this), 1572 timeDelay = $that.attr('data-delay'); 1573 1574 $that.appear(function() { 1575 setTimeout(function () { 1576 EUTHEM.pageSettings.clippingAnimated( $that ); 1577 }, timeDelay); 1578 },{accX: 0, accY: -150}); 1579 }); 1580 } 1581 }, 1582 clippingAnimated: function( $element ){ 1583 var delay = 700, 1584 $overlay = $element.find( '.eut-clipping-overlay' ); 1585 1586 $element.addClass('eut-clipping-animated'); 1587 1588 if ( $element.hasClass('eut-colored-clipping') ) { 1589 setTimeout(function(){ 1590 $element.addClass('eut-clipping-show-content'); 1591 },delay); 1592 1593 delay = 1400; 1594 } 1595 setTimeout(function(){ 1596 $overlay.remove(); 1597 $element.removeClass('eut-clipping-animation eut-clipping-animated eut-colored-clipping eut-clipping-show-content'); 1598 EUTHEM.basicElements.animAppear(); 1599 },delay); 1600 }, 1601 bodyLoader: function(){ 1602 var $overflow = $('#eut-loader-overflow'), 1603 $loader = $('.eut-spinner'), 1604 $link = $('a'); 1605 1606 if( $overflow.length > 0 ){ 1607 bodyLoader = true; 1608 } else { 1609 return; 1610 } 1611 1612 if(navigator.userAgent.indexOf('Safari') != -1 && navigator.userAgent.indexOf('Chrome') == -1 || navigator.userAgent.match(/(iPod|iPhone|iPad)/)){ 1613 window.onpageshow = function(event) { 1614 if (event.persisted) { 1615 $overflow.removeClass('eut-visible eut-hide'); 1616 window.location.reload(); 1617 } 1618 }; 1619 } else if(navigator.userAgent.indexOf('Firefox') != -1) { 1620 window.onunload = function(){}; 1621 } 1622 1623 if( $overflow.hasClass('eut-page-transition') ) { 1624 var exclude = ['.eut-no-transition', '.eut-toggle-modal'], 1625 comp = new RegExp(location.host); 1626 1627 $('a:not(' + exclude + ')').on('click',function(e){ 1628 var link = this; 1629 if( comp.test(link.href) && link.href.split(/\?|#/)[0] != location.href.split(/\?|#/)[0] && link.target != '_blank' && link.href[0] != '#') { 1630 if( link.href.indexOf( '#' ) == -1 && 1631 link.href.indexOf( 'skype:' ) == -1 && 1632 link.href.indexOf( 'mailto:' ) == -1 && 1633 link.href.indexOf( 'tel:' ) == -1 && 1634 link.href.indexOf( 'jpg' ) == -1 && 1635 link.href.indexOf( 'jpeg' ) == -1 && 1636 link.href.indexOf( 'png' ) == -1 && 1637 link.href.indexOf( 'gif' ) == -1 && 1638 link.href.indexOf( 'bmp' ) == -1 && 1639 link.href.indexOf( 'pdf' ) == -1 && 1640 link.href.indexOf( 'zip' ) == -1 && 1641 link.href.indexOf('add-to-cart=') == -1 ) { 1642 e.preventDefault(); 1643 var newLocation = this.href; 1644 $overflow.addClass('eut-visible').removeClass('eut-hide'); 1645 setTimeout(function(){ 1646 window.location = newLocation; 1647 }, 600); 1648 } 1649 } 1650 }); 1651 } 1652 1653 var images = $('img, .eut-bg-image'); 1654 $.each(images, function(){ 1655 var el = $(this), 1656 image = el.css('background-image').replace(/"/g, '').replace(/url\(|\)$/ig, ''); 1657 if(image && image !== '' && image !== 'none') 1658 images = images.add($('<img>').attr('src', image)); 1659 if(el.is('img')) 1660 images = images.add(el); 1661 }); 1662 1663 images.imagesLoaded(function(){ 1664 setTimeout(function () { 1665 if( $overflow.hasClass('eut-page-transition') ) { 1666 $overflow.removeClass('eut-visible').addClass('eut-hide'); 1667 setTimeout(function(){ 1668 bodyLoader = false;
1669 EUTHEM.basicElements.animAppear(); 1670 EUTHEM.pageSettings.clippingAppear(); 1671 EUTHEM.pageSettings.animAppear(); 1672 EUTHEM.svgAnimation.init(); 1673 EUTHEM.basicElements.counter(); 1674 }, 1200); 1675 } else { 1676 $loader.fadeOut(500); 1677 $overflow.delay(500).fadeOut(700,function(){ 1678 bodyLoader = false; 1679 EUTHEM.basicElements.animAppear(); 1680 EUTHEM.pageSettings.clippingAppear(); 1681 EUTHEM.pageSettings.animAppear(); 1682 EUTHEM.svgAnimation.init(); 1683 EUTHEM.basicElements.counter(); 1684 }); 1685 } 1686 }, 600); 1687 }); 1688 1689 }, 1690 changeOrder: function(){ 1691 var $element = $('.eut-change-order'), 1692 $parent = $element.parent(); 1693 $parent.each(function(){ 1694 var $that = $(this), 1695 $column = $that.children(), 1696 colLength = $column.length, 1697 tabletArr = $.makeArray( $column.not('.eut-change-order') ), 1698 tabletSmArr = $.makeArray( $column.not('.eut-change-order') ), 1699 mobileArr = $.makeArray( $column.not('.eut-change-order') ); 1700 1701 $column.each(function(num,value){ 1702 var $that = $(value); 1703 if( $that.hasClass('eut-change-order') ){ 1704 var tabletOrder = $that.data('tablet-order') !== undefined && $that.data('tablet-order') <= colLength ? $that.data('tablet-order') - 1 : $that.index(), 1705 tabletSmOrder = $that.data('tablet-sm-order') !== undefined && $that.data('tablet-sm-order') <= colLength ? $that.data('tablet-sm-order') - 1 : $that.index(), 1706 mobileOrder = $that.data('mobile-order') !== undefined && $that.data('mobile-order') <= colLength ? $that.data('mobile-order') - 1 : $that.index(); 1707 tabletArr.splice( tabletOrder, 0, value); 1708 tabletSmArr.splice( tabletSmOrder, 0, value);
1709 mobileArr.splice( mobileOrder, 0, value); 1710 } 1711 }); 1712 1713 $.each( tabletArr, function(i,n){ 1714 $( this ).addClass('eut-tablet-order-' + (i + 1)); 1715 }); 1716 1717 $.each( tabletSmArr, function(i,n){ 1718 $( this ).addClass('eut-tablet-sm-order-' + (i + 1)); 1719 }); 1720 1721 $.each( mobileArr, function(i,n){ 1722 $( this ).addClass('eut-mobile-order-' + (i + 1)); 1723 }); 1724 }); 1725 1726 }, 1727 stickyHeader : function(){ 1728 var $header = $('#eut-header'), 1729 $innerHeader = $('#eut-main-header'), 1730 stickyType = $header.data('sticky'); 1731 1732 if( stickyType === 'none' || !$header.length ) return; 1733 1734 var headerHeight = $header.height(), 1735 headerTop = $innerHeader.hasClass('eut-header-logo-top') ? $('#eut-bottom-header').offset().top : $header.offset().top, 1736 threshold = headerTop, 1737 stickyHeader = '#eut-main-header', 1738 thresholdBackground = $header.hasClass('eut-overlapping') || stickyType == 'scrollup' ? 0 : headerHeight, 1739 thresholdHeadIn = 0, 1740 thresholdHeadOut = headerTop + 500, 1741 onScrollUp = null, 1742 onScrollDown = null, 1743 stickyTop = 0, 1744 tolerance = { 1745 up : 0, 1746 down : 0 1747 }; 1748 1749 if( isMobile.any() ) { 1750 tolerance = { up : 20, down : 20 }; 1751 } 1752 1753 if( stickyType == 'scrollup' ){ 1754 threshold = $header.outerHeight() + headerTop; 1755 thresholdHeadIn = headerTop + headerHeight; 1756 onScrollUp = scrollUpCallback; 1757 onScrollDown = scrollDownCallback; 1758 } 1759 1760 if( $('body').hasClass('eut-framed') ){ 1761 stickyTop = $('#eut-frames').data('frame-size'); 1762 } 1763 1764 if( $innerHeader.hasClass('eut-header-logo-top') ) { 1765 stickyHeader = '#eut-bottom-header'; 1766 } 1767 1768 $header.StickyHeader({ 1769 stickyHeader : stickyHeader, 1770 thresholdSticky : threshold, 1771 thresholdBackground : thresholdBackground, 1772 thresholdHeadIn : thresholdHeadIn, 1773 thresholdHeadOut : thresholdHeadOut, 1774 stickyTop : stickyTop, 1775 tolerance : tolerance, 1776 onScrollUp : onScrollUp, 1777 onScrollDown : onScrollDown 1778 }); 1779 1780 function scrollUpCallback(){ 1781 if( $('#eut-page-anchor').length ) { 1782 var position = $header.data('sticky-height'); 1783 $('#eut-page-anchor').addClass('eut-go-down').removeClass('eut-go-up'); 1784 EUTHEM.anchorMenu.moveAnchor( '#eut-page-anchor', position ); 1785 } 1786 } 1787 1788 function scrollDownCallback(){ 1789 if( $('#eut-page-anchor').length ) { 1790 $('#eut-page-anchor').addClass('eut-go-up').removeClass('eut-go-down'); 1791 EUTHEM.anchorMenu.moveAnchor( '#eut-page-anchor', 0 ); 1792 } 1793 } 1794 }, 1795 responsiveStickyHeader : function(){ 1796 var $header = $('#eut-header'), 1797 $responsiveHeader = $('#eut-responsive-header'), 1798 $innerHeader = $('#eut-main-header'), 1799 sticky = $header.data('devices-sticky'); 1800 1801 if( sticky === 'no' || !$responsiveHeader.length ) return; 1802 1803 var headerHeight = $header.height(), 1804 headerTop = $responsiveHeader.offset().top, 1805 threshold = headerTop, 1806 thresholdHeadIn = 0; 1807 1808 $responsiveHeader.StickyHeader({ 1809 thresholdSticky : threshold, 1810 thresholdHeadIn : thresholdHeadIn 1811 }); 1812 }, 1813 stickyElements: function(){ 1814 if( $window.width() + scrollBarWidth > tabletPortrait ) { 1815 EUTHEM.pageSettings.initStickyElement(); 1816 } else { 1817 $stickyEl.trigger("sticky_kit:detach"); 1818 } 1819 }, 1820 1821 initStickyElement: function(){ 1822 $stickyEl.each(function(){ 1823 var $that = $(this), 1824 paddingT = $that.css('padding-top'), 1825 paddingL = $that.css('padding-left'), 1826 paddingB = $that.css('padding-bottom'), 1827 paddingR = $that.css('padding-right'), 1828 elPadding = paddingT + ' ' + paddingR + ' ' + paddingB + ' ' + paddingL, 1829 offset = $that.data('sticky-offset') !== undefined ? $that.data('sticky-offset') : 0, 1830 headerHeight = $('#eut-header').data('sticky') != 'none' && $('#eut-header').data('sticky') != 'scrollup' ? $('#eut-header').data('sticky-height') : 0, 1831 anchorBarHeight = $('.eut-anchor-menu').length ? $('.eut-anchor-menu').outerHeight() : 0, 1832 topOffset = offset + headerHeight + anchorBarHeight + wpBarHeight, 1833 $parent = $that.parents('.eut-row').length ? $that.parents('.eut-row') : $that.parent(); 1834 1835 $that.stick_in_parent({ 1836 parent: $parent, 1837 bottoming: true, 1838 inner_scrolling: false, 1839 offset_top: topOffset 1840 }).on("sticky_kit:stick", function(e) { 1841 $(this).css({ 1842 'padding-top' : paddingT, 1843 'z-index' : 9999 1844 }); 1845 this.style.setProperty('padding', elPadding, 'important'); 1846 }).on("sticky_kit:unstick", function(e) { 1847 this.style.setProperty('padding', ''); 1848 }); 1849 }); 1850 }, 1851 addVideoBg: function(){ 1852 $('.eut-yt-bg-video').each(function() { 1853 var $element = $(this); 1854 var url = $element.data("video-bg-url"); 1855 var videoID = url.match( /[\\?&]v=([^&#]*)/ )[ 1 ]; 1856 if( '' !== videoID ) { 1857 insertYouTubeVideo($element, videoID ); 1858 } 1859 }); 1860 $('.eut-html5-bg-video').each(function() { 1861 var $element = $(this); 1862 EUTHEM.pageSettings.resizeVideoBgElement( $element ); 1863 }); 1864 $('.eut-vimeo-bg-video').each(function() { 1865 var $element = $(this); 1866 if ("undefined" != typeof Vimeo ) { 1867 var videoPlayer = new Vimeo.Player( $element.attr('id') ); 1868 videoPlayer.on('loaded', function() { 1869 EUTHEM.pageSettings.resizeVideoBgElement( $element ); 1870 }); 1871 } 1872 }); 1873 function insertYouTubeVideo($element, youtubeId, counter) { 1874 if ("undefined" == typeof YT || "undefined" === typeof YT.Player) { 1875 counter = "undefined" === typeof counter ? 0 : counter; 1876 if (100 < counter) { 1877 console.warn("Too many attempts to load YouTube api"); 1878 return; 1879 } 1880 setTimeout(function() { 1881 insertYouTubeVideo($element, youtubeId, counter++); 1882 }, 100); 1883 return; 1884 } 1885 var startSeconds = $element.data('video-start') !== undefined ? parseInt( $element.data('video-start') ) : 0; 1886 var endSeconds = $element.data('video-end') !== undefined ? parseInt( $element.data('video-end') ) : 0;
1887 var $container = $element.prepend('<div class="eut-bg-youtube-video"><div class="inner"></div></div>').find(".inner"); 1888 var ytPlayer = new YT.Player($container[0], { 1889 width: "100%", 1890 height: "100%", 1891 videoId: youtubeId, 1892 playerVars: { 1893 playlist: youtubeId, 1894 iv_load_policy: 3, 1895 enablejsapi: 1, 1896 disablekb: 1, 1897 autoplay: 1, 1898 controls: 0, 1899 showinfo: 0, 1900 rel: 0, 1901 loop: 1, 1902 start: startSeconds, 1903 end: endSeconds, 1904 wmode: "transparent" 1905 }, 1906 events: { 1907 'onReady': onPlayerReady, 1908 'onStateChange': onPlayerStateChange 1909 } 1910 }); 1911 function onPlayerReady(event) { 1912 event.target.mute().setLoop(true); 1913 } 1914 function onPlayerStateChange(event) { 1915 if ( 0 !== startSeconds || 0 !== endSeconds ) { 1916 if (event.data === YT.PlayerState.ENDED) { 1917 ytPlayer.loadVideoById({ 1918 videoId: youtubeId, 1919 startSeconds: startSeconds, 1920 endSeconds: endSeconds 1921 }); 1922 } 1923 } 1924 } 1925 // Resize Video 1926 EUTHEM.pageSettings.resizeVideoBgElement( $element ); 1927 } 1928 }, 1929 resizeVideoBg: function(){ 1930 $videoBg.each(function(){ 1931 EUTHEM.pageSettings.resizeVideoBgElement( $(this) ); 1932 }); 1933 }, 1934 resizeVideoBgElement: function( $element ){ 1935 var videoEl, 1936 videoW, 1937 videoH, 1938 marginLeft, 1939 marginTop, 1940 containerW = $element.innerWidth(), 1941 containerH = $element.innerHeight(), 1942 ratio1 = 16, 1943 ratio2 = 9; 1944 1945 if (containerW / containerH < ratio1 / ratio2) { 1946 videoW = containerH * (ratio1 / ratio2); 1947 videoH = containerH; 1948 videoW += 'px'; 1949 videoH += 'px'; 1950 } else { 1951 videoW = containerW; 1952 videoH = containerW * (ratio2 / ratio1); 1953 videoW += 'px'; 1954 videoH += 'px'; 1955 } 1956 if( $element.hasClass('eut-yt-bg-video') || $element.hasClass('eut-vimeo-bg-video') || $element.hasClass('eut-iframe-bg-video') ) { 1957 videoEl = 'iframe'; 1958 } else { 1959 videoEl = 'video'; 1960 } 1961 1962 $element.find( videoEl ).css({ 1963 maxWidth: '1000%', 1964 width: videoEl == 'iframe' ? videoW : '', 1965 height: videoH 1966 }); 1967 }, 1968 removeVideoBg: function(){ 1969 $('.eut-background-wrapper').each(function () { 1970 var $wrapper = $(this), 1971 $bgImage = $wrapper.find('.eut-bg-image'), 1972 $bgVideo = $wrapper.find('.eut-bg-video'), 1973 $bgHtml5Video = $wrapper.find('.eut-html5-bg-video'), 1974 $bgYtVideo = $wrapper.find('.eut-yt-bg-video'), 1975 $bgVimeoVideo = $wrapper.find('.eut-vimeo-bg-video'), 1976 $bgIFrameVideo = $wrapper.find('.eut-iframe-bg-video'), 1977 $bgVideoButton = $wrapper.find('.eut-bg-video-button-device'); 1978 1979 var bgVideoDevice = $bgVideo.data('videoDevice') !== undefined ? $bgVideo.data('videoDevice') : 'no'; 1980 if( isMobile.any() && 'no' === bgVideoDevice) { 1981 $bgVideo.remove(); 1982 } else { 1983 1984 if ( $bgHtml5Video.length ) { 1985 var $videoElement = $wrapper.find('.eut-bg-video video'); 1986 var canPlayVideo = false; 1987 $wrapper.find('.eut-bg-video source').each(function(){ 1988 if ( $videoElement.get(0).canPlayType( $(this).attr('type') ) ) { 1989 canPlayVideo = true; 1990 } 1991 }); 1992 if(canPlayVideo) { 1993 $bgImage.remove(); 1994 } else { 1995 $bgVideo.remove(); 1996 } 1997 } 1998 if ( $bgYtVideo.length || $bgVimeoVideo.length || $bgIFrameVideo.length ) { 1999 $bgImage.remove(); 2000 } 2001 if ( $bgVideoButton.length ) { 2002 $bgVideoButton.remove(); 2003 } 2004 } 2005 }); 2006 }, 2007 linkGoToTop: function( element, delay, space ){ 2008 var $this = element, 2009 elementTop = $this.offset().top, 2010 header = $('#eut-header').length && $('#eut-main-header').is(":visible") ? true : false, 2011 responsiveHeader = $('#eut-responsive-header').length && $('#eut-responsive-header').is(":visible") ? true : false, 2012 headerHeight = header && $('#eut-header').data('sticky') != 'none' ? $('#eut-main-header').outerHeight() : 0, 2013 respHeaderH = responsiveHeader && $('#eut-header').data('devices-sticky') == 'yes' ? $('#eut-responsive-header').outerHeight() : 0, 2014 topBarHeight = $('#eut-top-bar').length ? $('#eut-top-bar').height() : 0, 2015 anchorBarHeight = $('.eut-anchor-menu').length ? $('.eut-anchor-menu').outerHeight() : 0, 2016 delayAnim = delay !== undefined ? delay : 300, 2017 topSpace = space !== undefined ? space : 0, 2018 offset = topBarHeight + wpBarHeight + headerHeight + respHeaderH + anchorBarHeight + topSpace; 2019 if( elementTop > 0 ){ 2020 $('html, body').delay(delayAnim).animate({ 2021 scrollTop: elementTop - offset 2022 }, 900, 'easeInOutCubic'); 2023 $("html, body").on("scroll mousedown DOMMouseScroll mousewheel keyup", function(){ 2024 $('html, body').stop(); 2025 }); 2026 return false;
2027 } 2028 }, 2029 mainMenu: function(){ 2030 var $mainMenu = $('#eut-header .eut-horizontal-menu ul.eut-menu'); 2031 2032 $('.eut-main-menu').find( 'a[href="#"]').on('click',function(e){ 2033 e.preventDefault(); 2034 }); 2035 2036 $mainMenu.superfish({ 2037 popUpSelector: '.sub-menu', 2038 delay: 300, 2039 speed: 'fast', 2040 cssArrows: false, 2041 onBeforeShow: function(){ 2042 2043 var $subMenu = $(this); 2044 if( !$subMenu.length ) return; 2045 var $li = $subMenu.parent(), 2046 windowW = $(window).width(), 2047 subMenuW = $subMenu.width(), 2048 liOffsetL = $li.offset().left; 2049 2050 if( $li.hasClass('megamenu')){ 2051 setTimeout(function(){ 2052 setEqualMenuColumns( $li ); 2053 },50); 2054 } 2055 2056 if( $li.hasClass('megamenu') && $li.css('position') == 'relative' ){ 2057 if(subMenuW + liOffsetL > windowW) { 2058 var left = windowW - (subMenuW + liOffsetL); 2059 $subMenu.css({'left' : left}); 2060 } 2061 } 2062 if( $('#eut-header .eut-first-level').length > 0 ){ 2063 if( !$li.hasClass('eut-first-level') && !$li.hasClass('megamenu') ){ 2064 var subMenuLength = $li.find('.sub-menu').length + 1, 2065 subMenuOffsetL = $li.parents('.eut-first-level').offset().left; 2066 if( (subMenuW * subMenuLength) + subMenuOffsetL > windowW) { 2067 $li.addClass('eut-invert'); 2068 } 2069 } else if( $li.hasClass('eut-first-level') && !$li.hasClass('megamenu') && $('#eut-header').hasClass('eut-fullwidth') ){ 2070 var menuOffsetL = $li.offset().left; 2071 if( subMenuW + menuOffsetL > windowW) { 2072 $li.addClass('eut-invert'); 2073 } 2074 } 2075 } 2076 2077 if( $('body').hasClass('eut-boxed') && ( $li.hasClass('megamenu column-3') || $li.hasClass('megamenu column-2') ) ){ 2078 var containerW = $('#eut-theme-wrapper').width(), 2079 containerL = $('#eut-theme-wrapper').offset().left, 2080 positionL = 0; 2081 2082 if( subMenuW + liOffsetL > containerW + containerL ){ 2083 positionL = (containerW + containerL) - (subMenuW + liOffsetL); 2084 } 2085 2086 $subMenu.css({ 2087 'left' : positionL 2088 }); 2089 } 2090 }, 2091 onHide: function(){ 2092 var $subMenu = $(this), 2093 $li = $subMenu.parent(); 2094 $li.removeClass('eut-invert'); 2095 2096 if( $li.hasClass('megamenu')){ 2097 removeEqualMenuColumns( $li ); 2098 } 2099 } 2100 }); 2101 2102 function setEqualMenuColumns( $li ) { 2103 var $subMenu = $li.children('ul'), 2104 $column = $subMenu.children('li'), 2105 maxHeight = 0; 2106 $column.each(function(){ 2107 var columnH = $(this).outerHeight(); 2108 if( columnH >= maxHeight ) { 2109 maxHeight = columnH; 2110 } 2111 }); 2112 $column.css({ 'height' : maxHeight }); 2113 } 2114 2115 function removeEqualMenuColumns( $li ) { 2116 var $subMenu = $li.children('ul'), 2117 $column = $subMenu.children('li'); 2118 $column.css({ 'height' : '' }); 2119 } 2120 2121 }, 2122 columnEffect: function(){ 2123 var $parallaxColumn = $('.eut-parallax-effect'), 2124 $section = $parallaxColumn.parents('.eut-section'); 2125 2126 $parallaxColumn.each(function(){ 2127 var $that = $(this), 2128 parallaxEffect = $that.data('parallax-effect'), 2129 tabletL = $that.data('tablet-landscape-parallax-effect') != 'none' && parallaxEffect == 'vertical-parallax' ? true : false, 2130 tabletP = $that.data('tablet-portrait-parallax-effect') != 'none' && parallaxEffect == 'vertical-parallax' ? true : false, 2131 mobileL = $that.data('mobile-parallax-effect') != 'none' && parallaxEffect == 'vertical-parallax' ? true : false, 2132 $section = $that.parents('.eut-section'); 2133 2134 imagesLoaded( $section, function() { 2135 $that.paraller({ 2136 tabletL : [tabletLandscape, tabletL], 2137 tabletP : [tabletPortrait, tabletP], 2138 mobileL : [mobileScreen, mobileL] 2139 }); 2140 }); 2141 }); 2142 }, 2143 eutModal: function(){ 2144 2145 var $button = $('.eut-toggle-modal'), 2146 $overlay = $('<div id="eut-modal-overlay" class="eut-body-overlay"></div>'), 2147 $closeBtn = $('<div class="eut-close-modal"><i class="eut-icon-close"></i></div>'), 2148 $themeWrapper = $('#eut-theme-wrapper'), 2149 content; 2150 2151 $button.on('click',function(e){ 2152 content = $(this).attr('href'); 2153 if( content.indexOf("#") === 0 && $(content).length > 0 ) { 2154 e.preventDefault(); 2155 2156 // Append Overlay on body 2157 $overlay.appendTo( $themeWrapper ); 2158 $closeBtn.appendTo( $(content) ); 2159 2160 $(content).addClass('prepare-anim'); 2161 2162 openModal(); 2163 2164 $closeBtn.on('click',function(e){ 2165 e.preventDefault(); 2166 closeModal(); 2167 }); 2168 2169 $(content).on('click',function(e){ 2170 if ( !$('.eut-modal-item').is(e.target) && $('.eut-modal-item').has(e.target).length === 0 ) { 2171 e.preventDefault(); 2172 closeModal(); 2173 } 2174 }); 2175 } 2176 }); 2177 2178 // Open Modal 2179 function openModal() { 2180 $overlay.fadeIn(function(){ 2181 $(content).addClass('animate'); 2182 2183 // Search Modal 2184 if( $(content).is('#eut-search-modal') ){ 2185 var $searchContent = $('#eut-search-modal'), 2186 $searchInput = $searchContent.find('.eut-search-textfield'); 2187 2188 $searchInput.val(''); 2189 setTimeout(function(){ 2190 $searchInput.focus(); 2191 },600); 2192 } 2193 }); 2194 } 2195
2196 // Close Modal 2197 function closeModal() { 2198 $(content).removeClass('animate mobile'); 2199 setTimeout(function(){ 2200 $overlay.fadeOut(function(){ 2201 $(content).removeClass('prepare-anim'); 2202 $overlay.remove(); 2203 $closeBtn.remove(); 2204 }); 2205 },600); 2206 } 2207 2208 $(document).on('keyup',function(evt) { 2209 if (evt.keyCode == 27 && $(content).hasClass('animate') ) { 2210 closeModal(); 2211 } 2212 }); 2213 2214 }, 2215 gotoFirstSection: function(){ 2216 var $selector = $('#eut-feature-section .eut-goto-section'), 2217 $nextSection = $('#eut-content'); 2218 2219 $selector.on('click',function(){ 2220 $('html,body').animate({ 2221 scrollTop: $nextSection.offset().top 2222 }, 1000); 2223 return false; 2224 }); 2225 }, 2226 bgLoader: function() { 2227 2228 var $selector = $('#eut-header .eut-bg-image, #eut-content .eut-bg-image, #eut-footer .eut-bg-image, .eut-navigation-bar .eut-bg-image, #eut-sidearea .eut-bg-image'); 2229 $selector.each(function () { 2230 var $selector = $(this); 2231 if( $selector.data('loader') == 'yes' ){ 2232 EUTHEM.pageSettings.addSpinner( $selector ); 2233 } 2234 function imageUrl(input) { 2235 return input.replace(/"/g,"").replace(/url\(|\)$/ig, ""); 2236 } 2237 var image = new Image(), 2238 $that = $(this); 2239 image.src = imageUrl($that.css('background-image')); 2240 image.onload = function () { 2241 if( $selector.data('loader') == 'yes' ){ 2242 EUTHEM.pageSettings.removeSpinner( $selector ); 2243 } else { 2244 $that.addClass('show'); 2245 } 2246 }; 2247 }); 2248 }, 2249 addSpinner: function( $selector ){ 2250 var $section = $selector; 2251 $(spinner).appendTo( $section.parent() ); 2252 }, 2253 removeSpinner: function( $selector ){ 2254 2255 var $section = $selector.parent(), 2256 $spinner = $section.find('.eut-spinner'); 2257 2258 $spinner.fadeOut(600,function(){ 2259 $selector.addClass('show'); 2260 $spinner.remove(); 2261 }); 2262 }, 2263 fitVid: function(){ 2264 $('.eut-video, .eut-media').fitVids(); 2265 $('iframe[src*="youtube"]').parent(":not(.eut-bg-youtube-video)").fitVids(); 2266 $('iframe[src*="vimeo"]').parent().fitVids(); 2267 }, 2268 hiddenArea: function( section, btn ){ 2269 var $btn = $('.eut-toggle-hiddenarea'), 2270 $themeWrapper = $('#eut-theme-wrapper'), 2271 $closeBtn = $('.eut-hidden-area').find('.eut-close-btn'), 2272 startTimer = false, 2273 count = -1, 2274 itemLength = 0, 2275 counter, 2276 areaWidth = 0, 2277 content, 2278 $overlay; 2279 2280 $btn.on('click',function(e){ 2281 content = $(this).attr('href'); 2282 if( content.indexOf("#") === 0 && $(content).length > 0 ) { 2283 e.preventDefault(); 2284 var overlayId = content.replace('#',''); 2285 2286 $(content).addClass('prepare-anim'); 2287 $overlay = $('<div id="' + overlayId + '-overlay" class="eut-body-overlay"></div>'); 2288 2289 // Append Overlay on body 2290 $overlay.appendTo( $themeWrapper ); 2291 2292 // Calculate Width 2293 areaWidth = hiddenAreaWidth( content ); 2294 $(window).smartresize(function(){ 2295 areaWidth = hiddenAreaWidth( content ); 2296 }); 2297 2298 if( $(content).hasClass('open') ) { 2299 closeHiddenArea(); 2300 } else { 2301 openHiddenArea(); 2302 } 2303 2304 // For One Page 2305 var $link = $(content).find('a[href*="#"]:not( [href="#"] )'); 2306 $link.on('click',function(){ 2307 var target = $(this.hash), 2308 targetHash = this.hash, 2309 dataValue = this.hash.replace('#',''); 2310 if ( target.length && ( target.hasClass('eut-section') || target.hasClass('eut-bookmark') || target.hasClass('eut-tab-content') || target.hasClass('eut-accordion-content') ) ) { 2311 closeHiddenArea(); 2312 } 2313 // For Fullpage Scrolling 2314 if( $('[data-anchor="' + dataValue + '"]').length ){ 2315 closeHiddenArea(); 2316 } 2317 }); 2318 2319 } 2320 }); 2321 2322 $closeBtn.on('click',function(){ 2323 closeHiddenArea(); 2324 }); 2325 2326 // Open Hidden Area 2327 function openHiddenArea() { 2328 $overlay.fadeIn(function(){ 2329 $('body').scrollTop( 0 ); 2330 $(content).addClass('open'); 2331 $(this).on('click',function(){ 2332 closeHiddenArea(); 2333 }); 2334 }); 2335 } 2336 // Close Hidden Area 2337 function closeHiddenArea() { 2338 $themeWrapper.css({ 'height' : 'auto' }); 2339 $(content).removeClass('open'); 2340 $overlay.fadeOut(function(){ 2341 $overlay.remove(); 2342 $(content).removeClass('prepare-anim'); 2343 }); 2344 } 2345 2346 // Calculate Area Width 2347 function hiddenAreaWidth( area ){ 2348 var $area = $(area), 2349 windowWidth = $(window).width(); 2350 2351 if( $(window).width() + scrollBarWidth <= mobileScreen ) { 2352 $(area).css({ 'width' : windowWidth + 30 }); 2353 } else { 2354 if( $area.hasClass('eut-large-width') ) { 2355 $(area).css({ 'width' : Math.max(550, (windowWidth / 2)) }); 2356 } else if( $area.hasClass('eut-medium-width') ) { 2357 $(area).css({ 'width' : Math.max(550, (windowWidth / 3)) }); 2358 } else { 2359 $(area).css({ 'width' : Math.max(550, (windowWidth / 4)) }); 2360 } 2361 } 2362 2363 return areaWidth; 2364 } 2365 2366 }, 2367 hiddenAreaHeight: function( area ){ 2368 if( $(area).length === 0 ) return; 2369 2370 var windowWidth = $(window).width(), 2371 windowHeight = $(window).height(), 2372 hiddenAreaHeight = $(area).find('.eut-hiddenarea-content').outerHeight() + 200, 2373 $themeWrapper = $('#eut-theme-wrapper'), 2374 $scroller = $(area).find('.eut-scroller'), 2375 $buttonWrapper = $(area).find('.eut-buttons-wrapper'), 2376 btnWrapperHeight = $buttonWrapper.length ? $buttonWrapper.height() : 0, 2377 sideHeight = 0; 2378 2379 if( hiddenAreaHeight > windowHeight ){ 2380 sideHeight = hiddenAreaHeight; 2381 } else { 2382 sideHeight = windowHeight; 2383 } 2384 2385 if( $(window).width() + scrollBarWidth <= mobileScreen ) { 2386 $scroller.css({ 'height' : 'auto' }); 2387 $(area).css({ 'position' : 'absolute','height' : sideHeight }); 2388 $themeWrapper.css({ 'height' : sideHeight, 'overflow' : 'hidden' }); 2389 } else { 2390 $scroller.css({ 'height' : windowHeight - btnWrapperHeight - 150 }); 2391 $themeWrapper.css({ 'height' : '', 'overflow' : '' }); 2392 } 2393 }, 2394 sideArea: function(){ 2395 var $btn = $('.eut-toggle-sidearea'), 2396 $themeWrapper = $('#eut-theme-wrapper'), 2397 content; 2398 2399 $btn.on('click',function(e){ 2400 content = $(this).attr('href'); 2401 if( content.indexOf("#") === 0 && $(content).length > 0 ) { 2402 e.preventDefault(); 2403 2404 $(content).addClass('eut-active-sidearea'); 2405 if( !$themeWrapper.hasClass('eut-side-area-open') ) { 2406 EUTHEM.pageSettings.openSideArea(); 2407 } else { 2408 EUTHEM.pageSettings.closeSideArea(); 2409 } 2410 } 2411 }); 2412 2413 $(document).on('keyup',function(evt) { 2414 if (evt.keyCode == 27) { 2415 EUTHEM.pageSettings.closeSideArea(); 2416 } 2417 }); 2418 2419 $('.eut-sidearea-close-btn').on('click',function(e){ 2420 e.preventDefault(); 2421 EUTHEM.pageSettings.closeSideArea(); 2422 }); 2423 }, 2424 openSideArea: function(){ 2425 2426 if ( !$('body').hasClass('eut-side-area-open') ) { 2427 $('body').addClass('eut-side-area-open'); 2428 var $themeWrapper = $('#eut-theme-wrapper'), 2429 wrapperH = $(window).height(), 2430 topP = $(window).scrollTop(), 2431 $btn = $('.eut-toggle-sidearea'), 2432 $closeBtn = $('.eut-sidearea-close-btn'), 2433 $sideArea = $('.eut-active-sidearea'); 2434 2435 $btn.addClass('eut-hide'); 2436 setTimeout(function(){ 2437 $closeBtn.removeClass('eut-hide'); 2438 },800); 2439 2440 if ( $.fn.StickyHeader && 'none' != $('#eut-header').data('sticky') ) { 2441 $('#eut-header').data('eut_StickyHeader').unbindEvents(); 2442 } 2443 2444 $sideArea.addClass('eut-show').css({ 2445 'padding-top' : (wrapperH * 20)/100 2446 }); 2447 $('.eut-wrapper-inner').css({ 2448 'top' : -topP, 2449 'position' : 'relative' 2450 }); 2451 $themeWrapper.addClass('eut-with-side-area').css({ 2452 'height' : wrapperH 2453 }
2453).addClass('eut-side-area-open eut-side-area-shadow'); 2454 } 2455 }, 2456 closeSideArea: function(){ 2457 2458 if ( $('body').hasClass('eut-side-area-open') ) { 2459 var $themeWrapper = $('#eut-theme-wrapper'), 2460 topP = Math.abs( parseInt( $('.eut-wrapper-inner').css('top') ) ), 2461 $btn = $('.eut-toggle-sidearea'), 2462 $closeBtn = $('.eut-sidearea-close-btn'), 2463 $sideArea = $('.eut-active-sidearea'); 2464 2465 $themeWrapper.removeClass('eut-side-area-open'); 2466 2467 $closeBtn.addClass('eut-hide'); 2468 2469 setTimeout(function(){ 2470 $themeWrapper.css({ 2471 'height' : '' 2472 }).removeClass('eut-with-side-area eut-side-area-shadow'); 2473 $('.eut-wrapper-inner').css({ 2474 'top' : '', 2475 'position' : '' 2476 }); 2477 $('html, body').scrollTop( topP ); 2478 if ( $.fn.StickyHeader && 'none' != $('#eut-header').data('sticky') ) { 2479 $('#eut-header').data('eut_StickyHeader').bindEvents(); 2480 } 2481 $('body').removeClass('eut-side-area-open'); 2482 $btn.removeClass('eut-hide'); 2483 $sideArea.removeClass('eut-show'); 2484 },800); 2485 } 2486 }, 2487 backtoTop: function() { 2488 var selectors = { 2489 topBtn : '.eut-back-top', 2490 dividerBtn : '.eut-divider-backtotop', 2491 topLink : 'a[href="#eut-goto-header"]' 2492 }, 2493 footerBarHeight = $('.eut-footer-bar.eut-fullwidth').length ? $('.eut-footer-bar.eut-fullwidth').outerHeight() : 0; 2494 2495 if( $( selectors.topBtn ).length ) { 2496 2497 $(window).on('scroll', function() { 2498 var scroll = $(this).scrollTop(), 2499 $topBtn = $( selectors.topBtn ); 2500 2501 if (scroll > 600) { 2502 $topBtn.addClass('show'); 2503 } else { 2504 $topBtn.removeClass('show'); 2505 } 2506 2507 if ( scroll > 600 && !$('body').hasClass('eut-side-area-open') ) { 2508 $('.eut-sidearea-btn').addClass('eut-push-up'); 2509 } else if( scroll < 600 && !$('body').hasClass('eut-side-area-open') ) { 2510 $('.eut-sidearea-btn').removeClass('eut-push-up'); 2511 } 2512 }); 2513 } 2514 2515 $.each(selectors, function(key, value){ 2516 $(value).on('click', function(e){ 2517 e.preventDefault(); 2518 var scrollTop = Math.abs($(window).scrollTop()) / 2, 2519 speed = scrollTop < 1000 ? 1000 : scrollTop; 2520 2521 if( $(this).data('speed') != undefined && $(this).data('speed') != 'height-based' ) { 2522 speed = $(this).data('speed'); 2523 } 2524 2525 // Remove Scroll Up Classes 2526 if ( $.fn.StickyHeader && $('#eut-header').data('sticky') === 'scrollup' ) { 2527 $('#eut-header').data('eut_StickyHeader').destroyScrollUp(); 2528 } 2529 $('html, body').animate({scrollTop: 0}, speed, 'easeInOutCubic'); 2530 $("html, body").on("scroll mousedown DOMMouseScroll mousewheel keyup", function(){ 2531 $('html, body').stop(); 2532 }); 2533 }); 2534 }); 2535 2536 }, 2537 animatedBg: function(){ 2538 var $section = $('.eut-section'); 2539 2540 $section.each(function(){ 2541 var $this = $(this); 2542 2543 if( $this.hasClass('eut-bg-animated') ) { 2544 zoomBg( $this ); 2545 } else if( $this.hasClass('eut-bg-horizontal') ) { 2546 horizontalBg( $this ); 2547 } 2548 }); 2549 2550 function zoomBg( $this ){ 2551 $this.mouseenter(function() { 2552 $this.addClass('zoom'); 2553 }); 2554 $this.mouseleave(function() { 2555 $this.removeClass('zoom'); 2556 }); 2557 } 2558 2559 function horizontalBg( $this ){ 2560 var bgPosition = 0; 2561 setInterval(function(){ 2562 bgPosition++; 2563 $this.find('.eut-bg-image').css({ 'background-position' : bgPosition+'px center', 'background-repeat' : 'repeat' }); 2564 },75); 2565 } 2566 }, 2567 onePageSettings: function(){ 2568 2569 // On Scroll Event 2570 $(window).on('scroll.eut_onepage', function(){ 2571 EUTHEM.pageSettings.onePageMenu(); 2572 }); 2573 2574 $('a[href*="#"]:not( [href="#"] )').on('click', function(e) { 2575 var headerHeight = $('#eut-header').length && ( $('#eut-header').data('sticky') != 'none' && $('#eut-header').data('sticky') != 'scrollup' ) ? $('#eut-header').data('sticky-height') : 0, 2576 anchorBarHeight = $('.eut-anchor-menu').length && !$('.eut-anchor-menu').hasClass('eut-anchor-responsive') ? $('.eut-anchor-menu').outerHeight() : 0, 2577 target = $(this.hash), 2578 targetHash = this.hash; 2579 2580 // Remove Scroll Up Classes 2581 if ( $.fn.StickyHeader && $('#eut-header').data('sticky') === 'scrollup' ) { 2582 $('#eut-header').data('eut_StickyHeader').destroyScrollUp(); 2583 } 2584 2585 if ( target.length && ( target.hasClass('eut-section') || target.hasClass('eut-inner-section') || target.hasClass('eut-bookmark') ) ) { 2586 $('html,body').animate({ 2587 scrollTop: target.offset().top - headerHeight - anchorBarHeight + 1 2588 }, 1000); 2589 return false;
2590 } 2591 if ( target.length && ( target.hasClass('eut-tab-content') || target.hasClass('eut-accordion-content') ) ) { 2592 var tabLink = $('.eut-tab-link[data-rel="' + targetHash + '"]:visible'); 2593 if ( tabLink.length ) { 2594 tabLink.click(); 2595 setTimeout(function() { 2596 EUTHEM.pageSettings.linkGoToTop( tabLink ); 2597 }, 500); 2598 } 2599 return false; 2600 } 2601 }); 2602 }, 2603 onePageMenu: function(){ 2604 var $section = $('#eut-main-content .eut-section[id], #eut-main-content .eut-inner-section[id]'); 2605 if ( $section.length === 0 ) return; 2606 2607 var sideHeader = $('#eut-main-header').hasClass('eut-header-side') ? true : false, 2608 headerHeight = $('#eut-header').attr('data-sticky-header') != 'none' && !sideHeader ? $('#eut-main-header').outerHeight() : 0, 2609 anchorBarHeight = $('.eut-anchor-menu').length ? $('.eut-anchor-menu').outerHeight() : 0, 2610 offsetTop = headerHeight + anchorBarHeight + wpBarHeight, 2611 scroll = $(window).scrollTop(); 2612 2613 $section.each(function(){ 2614 var $that = $(this), 2615 currentId = $that.attr('id'), 2616 sectionOffset = $that.offset().top - offsetTop; 2617 2618 if (sectionOffset <= scroll && sectionOffset + $that.outerHeight() > scroll ) { 2619 $('a[href*="#' + currentId + '"]').parent().addClass('active'); 2620 } 2621 else{ 2622 $('a[href*="#' + currentId + '"]').parent().removeClass("active"); 2623 } 2624 2625 }); 2626 }, 2627 showList: function(){ 2628 var $list = $('.eut-show-list'); 2629 $list.ShowListItems(); 2630 // if ( isMobile.any() ) { 2631 // $list.data('eut_ShowListItems').destroy(); 2632 // }; 2633 }, 2634 fixedFooter: function(){ 2635 var $footer = $('#eut-footer'), 2636 sticky = $footer.data('sticky-footer'), 2637 prevSection = $footer.prev(), 2638 prevMargin = parseInt( prevSection.css('margin-bottom') ), 2639 delay; 2640 2641 if( !$footer.length || sticky != 'yes' || isMobile.any() ) return; 2642 2643 // On window events 2644 $( window ).on( 'scroll', function(){ 2645 update(); 2646 }); 2647 $(window).on('resize',resizer); 2648 2649 function resizer(){ 2650 window.clearTimeout(delay); 2651 delay = window.setTimeout(function() { 2652 $footer.prev().css( 'margin-bottom','' ); 2653 prevMargin = parseInt( prevSection.css('margin-bottom') ); 2654 update(); 2655 }, 900); 2656 } 2657 2658 update(); 2659 2660 function update(){ 2661 var windowWidth = $(window).width(), 2662 windowHeight = $(window).height(), 2663 footerHeight = $footer.outerHeight(), 2664 margin = footerHeight + prevMargin; 2665 2666 if( ( windowWidth + scrollBarWidth <= tabletLandscape ) || ( footerHeight > windowHeight ) ) { 2667 $footer.removeClass('eut-fixed-footer').prev().css( 'margin-bottom','' ); 2668 } else { 2669 $footer.addClass('eut-fixed-footer').prev().css( 'margin-bottom',margin ); 2670 } 2671 } 2672 2673 }, 2674 productImageParallax: function(){ 2675 $('#eut-product-feature-image .eut-product-parallax-image img').paraller({ 2676 wrapper : '.eut-product-area-wrapper', 2677 effect : 'mouse-move-x', 2678 sensitive : 'normal', 2679 invert : true 2680 }); 2681 }, 2682 lightGallery: function(){ 2683 var thumbnail = false; 2684 if( 1 == crocal_eutf_main_data.woo_popup_thumbs ) { 2685 thumbnail = true; 2686 } 2687 $('.eut-woo-light-gallery-popup').lightGallery({ 2688 selector: '.eut-popup-link', 2689 thumbnail: thumbnail, 2690 hash: false, 2691 }); 2692 $('.eut-gallery-popup').lightGallery({ 2693 selector: '.eut-item-url', 2694 thumbnail: false, 2695 hash: false, 2696 }); 2697 $('.eut-post-gallery-popup').lightGallery({ 2698 selector: 'a', 2699 thumbnail: false, 2700 hash: false, 2701 }); 2702 $('.eut-light-gallery').lightGallery({ 2703 selector: '.eut-item-url', 2704 thumbnail: false, 2705 hash: false, 2706 }); 2707 $('.eut-image-popup').lightGallery({ 2708 selector: 'this', 2709 thumbnail: false, 2710 hash: false, 2711 }); 2712 2713 if ( $('.eut-body').hasClass( 'eut-privacy-video-embeds-disabled' ) ) { 2714 $('.eut-video-popup').each(function() { 2715 $(this).attr({"target" : "_blank"}); 2716 }); 2717 } else { 2718 $('.eut-video-popup').lightGallery({ 2719 selector: 'this', 2720 thumbnail: false, 2721 hash: false, 2722 }); 2723 } 2724 2725 if( 1 == crocal_eutf_main_data.wp_gallery_popup ) { 2726 $('.gallery').lightGallery({ 2727 selector: '.gallery-item a', 2728 getCaptionFromTitleOrAlt: false, 2729 thumbnail: false, 2730 hash: false, 2731 }); 2732 $('.wp-block-gallery').lightGallery({ 2733 selector: '.blocks-gallery-item a', 2734 getCaptionFromTitleOrAlt: false, 2735 thumbnail: false, 2736 hash: false, 2737 }); 2738 } 2739 }, 2740 lightBox: function(){ 2741 //Inline Modal Popup 2742 $('.eut-modal-popup').each(function() { 2743 $(this).magnificPopup({ 2744 disableOn: 0, 2745 type: 'inline', 2746 preloader: false, 2747 prependTo: '#eut-theme-wrapper', 2748 fixedBgPos: true, 2749 fixedContentPos: true, 2750 removalDelay: 200, 2751 closeMarkup: '<div class="mfp-close eut-close-modal"></div>', 2752 closeOnBgClick: true, 2753 callbacks: { 2754 beforeOpen: function() { 2755 var mfpWrap = this.wrap; 2756 this.bgOverlay.fadeIn(200); 2757 addSpinner( mfpWrap ); 2758 this.container.css({'opacity':0}); 2759 }, 2760 open: function() { 2761 var $spinner = this.wrap.find('.eut-spinner'), 2762 $content = this.container; 2763 removeSpinner( $spinner, $content ); 2764 if( $content.find('.eut-isotope').length ) { 2765 setTimeout(function(){ 2766 EUTHEM.isotope.relayout(); 2767 },100); 2768 } 2769 if( $content.find('.owl-carousel').length ) { 2770 setTimeout(function(){ 2771 $content.find('.owl-carousel').each(function(){ 2772 var owl = $(this).data('owlCarousel'); 2773 owl.onResize(); 2774 }); 2775 },300); 2776 } 2777 if( $content.find('.eut-map').length ) { 2778 $('.eut-map').trigger( "eut_redraw_map" ); 2779 } 2780 }, 2781 beforeClose: function() { 2782 this.wrap.fadeOut(100); 2783 this.container.css({'opacity' : 0}); 2784 this.bgOverlay.fadeOut(100); 2785 }, 2786 } 2787 }); 2788 }); 2789 //VIDEOS 2790 $('.eut-page-popup').each(function() { 2791 $(this).magnificPopup({ 2792 disableOn: 0, 2793 type: 'iframe', 2794 preloader: false, 2795 fixedBgPos: true, 2796 fixedContentPos: true, 2797 removalDelay: 200, 2798 closeMarkup: '<div class="mfp-close eut-close-modal"></div>', 2799 closeOnBgClick: true, 2800 callbacks: { 2801 beforeOpen: function() { 2802 var mfpWrap = this.wrap; 2803 this.bgOverlay.fadeIn(200); 2804 addSpinner( mfpWrap ); 2805 }, 2806 open: function() { 2807 var $spinner = this.wrap.find('.eut-spinner'), 2808 $content = this.container; 2809 removeSpinner( $spinner, $content ); 2810 }, 2811 beforeClose: function() { 2812 this.wrap.fadeOut(100); 2813 this.container.css({'opacity' : 0}); 2814 this.bgOverlay.fadeOut(100); 2815 }, 2816 } 2817 }); 2818 }); 2819 2820 $('.eut-html5-video-popup').each(function() { 2821 $(this).magnificPopup({ 2822 disableOn: 0, 2823 type: 'inline', 2824 preloader: false, 2825 prependTo: '#eut-theme-wrapper', 2826 fixedBgPos: true, 2827 fixedContentPos: true, 2828 removalDelay: 200, 2829 closeMarkup: '<div class="mfp-close eut-close-modal"></div>', 2830 closeOnBgClick: true, 2831 callbacks: { 2832 beforeOpen: function() { 2833 var mfpWrap = this.wrap; 2834 this.bgOverlay.fadeIn(200); 2835 addSpinner( mfpWrap ); 2836 }, 2837 open: function() { 2838 var $spinner = this.wrap.find('.eut-spinner'), 2839 $content = this.container; 2840 removeSpinner( $spinner, $content ); 2841 if ( $content.find('video').length ) { 2842 setTimeout(function(){ 2843 $content.find('video')[0].play(); 2844 },500); 2845 } 2846 }, 2847 beforeClose: function() { 2848 if ( this.wrap.find('video').length ) { 2849 this.wrap.find('video')[0].load(); 2850 } 2851 this.wrap.fadeOut(100); 2852 this.container.css({'opacity' : 0}); 2853 this.bgOverlay.fadeOut(100); 2854 }, 2855 } 2856 }); 2857 }); 2858 2859 function addSpinner( mfpWrap ){ 2860 $(spinner).appendTo( mfpWrap ); 2861 } 2862 2863 function removeSpinner( spinner, content ){ 2864 setTimeout(function(){ 2865 spinner.fadeOut(1000, function(){ 2866 content.animate({'opacity':1},600); 2867 $('.eut-modal-popup').trigger( 'eut_open_modal' ); 2868 $(spinner).remove(); 2869 }); 2870 }, 700); 2871 } 2872 }, 2873 socialShareLinks: function(){ 2874 $(document).on('click','.eut-social-share-facebook',function(e){ 2875 e.preventDefault(); 2876 var shareUrl = $(this).attr('data-share-url') ? $(this).attr('data-share-url') : $(this).attr('href'); 2877 window.open( 'https://www.facebook.com/sharer/sharer.php?u=' + shareUrl, "facebookWindow", "height=380,width=660,resizable=0,toolbar=0,menubar=0,status=0,location=0,scrollbars=0" ); 2878 return false;
2879 }); 2880 $(document).on('click','.eut-social-share-twitter',function(e){ 2881 e.preventDefault(); 2882 var shareUrl = $(this).attr('data-share-url') ? $(this).attr('data-share-url') : $(this).attr('href'); 2883 window.open( 'http://twitter.com/intent/tweet?text=' + encodeURIComponent( $(this).attr('title') ) + ' ' + shareUrl, "twitterWindow", "height=450,width=660,resizable=0,toolbar=0,menubar=0,status=0,location=0,scrollbars=0" ); 2884 return false; 2885 }); 2886 $(document).on('click','.eut-social-share-linkedin',function(e){ 2887 e.preventDefault(); 2888 var shareUrl = $(this).attr('data-share-url') ? $(this).attr('data-share-url') : $(this).attr('href'); 2889 window.open( 'http://www.linkedin.com/shareArticle?mini=true&url=' + shareUrl + '&title=' + encodeURIComponent( $(this).attr('title') ), "linkedinWindow", "height=500,width=820,resizable=0,toolbar=0,menubar=0,status=0,location=0,scrollbars=0" ); 2890 return false; 2891 }); 2892 $(document).on('click','.eut-social-share-pinterest',function(e){ 2893 e.preventDefault(); 2894 var shareUrl = $(this).attr('data-share-url') ? $(this).attr('data-share-url') : $(this).attr('href'); 2895 window.open( 'http://pinterest.com/pin/create/button/?url=' + shareUrl + '&media=' + $(this).data('pin-img') + '&description=' + encodeURIComponent( $(this).attr('title') ), "pinterestWindow", "height=600,width=600,resizable=0,toolbar=0,menubar=0,status=0,location=0,scrollbars=0" ); 2896 return false; 2897 }); 2898 $(document).on('click','.eut-social-share-reddit',function(e){ 2899 e.preventDefault(); 2900 var shareUrl = $(this).attr('data-share-url') ? $(this).attr('data-share-url') : $(this).attr('href'); 2901 window.open( '//www.reddit.com/submit?url=' + shareUrl, "redditWindow", "height=600,width=820,resizable=0,toolbar=0,menubar=0,status=0,location=0,scrollbars=1" ); 2902 return false; 2903 }); 2904 $(document).on('click','.eut-social-share-tumblr',function(e){ 2905 e.preventDefault(); 2906 var shareUrl = $(this).attr('data-share-url') ? $(this).attr('data-share-url') : $(this).attr('href'); 2907 window.open( '//www.tumblr.com/share/link?url=' + shareUrl + '&name=' + encodeURIComponent( $(this).attr('title') ) , "tumblrWindow", "height=600,width=600,resizable=0,toolbar=0,menubar=0,status=0,location=0,scrollbars=1" ); 2908 return false; 2909 }); 2910 $(document).on('click','.eut-like-counter-link',function(e){ 2911 e.preventDefault(); 2912 var link = $(this); 2913 var id = link.data('post-id'), 2914 counter = link.parent().find('.eut-like-counter'), 2915 icon = link.find('i'); 2916 2917 var dataParams = { 2918 action:'crocal_eutf_likes_callback', 2919 eut_likes_id: id, 2920 _eutf_nonce: crocal_eutf_main_data.nonce_likes 2921 }; 2922 2923 $.post( crocal_eutf_main_data.ajaxurl, dataParams , function( response ) { 2924 if ( '-1' != response ) { 2925 if( 'active' == response.status ){ 2926 link.addClass('active'); 2927 icon.addClass('eut-heading-color'); 2928 } else { 2929 link.removeClass('active'); 2930 icon.removeClass('eut-heading-color'); 2931 } 2932 counter.html(response.likes); 2933 } 2934 }).fail(function(xhr, status, error) { 2935 }); 2936 2937 return false; 2938 }); 2939 } 2940 }; 2941 2942 // # Basic Elements 2943 // ============================================================================= // 2944 EUTHEM.basicElements = { 2945 init: function(){ 2946 this.pieChart(); 2947 this.progressBars(); 2948 this.counter(); 2949 this.slider(); 2950 this.testimonial(); 2951 this.flexibleCarousel(); 2952 this.carousel(); 2953 this.advancedCarousel(); 2954 this.advancedPromo(); 2955 this.doubleImageText(); 2956 this.portfolioParallax(); 2957 this.teamParallax(); 2958 this.testimonialParallax(); 2959 this.messageBox(); 2960 this.wooProduct(); 2961 this.animAppear(); 2962 this.htmlVideoPlayWhenAppear(); 2963 this.accordionToggle(); 2964 this.tabs(); 2965 this.productSocials(); 2966 this.countdown(); 2967 this.hovers(); 2968 }, 2969 pieChart: function(){ 2970 2971 $('.eut-chart-number').each(function() { 2972 var $element = $(this), 2973 delay = $element.parent().data('delay') !== '' ? parseInt( $element.parent().data('delay') ) : 0, 2974 size = $element.data('pie-size'), 2975 chartSize = '130'; 2976 if( size == 'small' ){ 2977 chartSize = '100'; 2978 } 2979 if( size == 'large' ){ 2980 chartSize = '160'; 2981 } 2982 2983 $element.css({ 'width' : chartSize, 'height' : chartSize, 'line-height' : chartSize + 'px' }); 2984 2985 if( $element.parents('.eut-modal-element').length ){ 2986 $('.eut-modal-popup').on( 'eut_open_modal', function(){ 2987 EUTHEM.basicElements.pieChartInit( $element, chartSize ); 2988 }); 2989 } else { 2990 $element.appear(function() { 2991 setTimeout(function () { 2992 EUTHEM.basicElements.pieChartInit( $element, chartSize ); 2993 }, delay); 2994 }); 2995 } 2996 }); 2997 2998 }, 2999 pieChartInit: function( $element, size ){ 3000 3001 var activeColor = $element.data('pie-active-color') !== '' ? $element.data('pie-active-color') : 'rgba(0,0,0,1)', 3002 pieColor = $element.data('pie-color') !== '' ? $element.data('pie-color') : 'rgba(0,0,0,0.1)', 3003 pieLineCap = $element.data('pie-line-cap') !== '' ? $element.data('pie-line-cap') : 'round', 3004 lineSize = $element.data('pie-line-size') !== '' ? $element.data('pie-line-size') : '6', 3005 chartSize = size; 3006 3007 3008 $element.easyPieChart({ 3009 barColor: activeColor, 3010 trackColor: pieColor, 3011 scaleColor: false, 3012 lineCap: pieLineCap, 3013 lineWidth: lineSize, 3014 animate: 1500, 3015 size: chartSize 3016 }); 3017 }, 3018 progressBars: function(){ 3019 $('.eut-progress-bar').each(function() { 3020 3021 var $element = $(this); 3022 if( $element.parents('.eut-modal-element').length ){ 3023 $('.eut-modal-popup').on( 'eut_open_modal', function(){ 3024 EUTHEM.basicElements.progressBarsInit( $element ); 3025 }); 3026 } else { 3027 $element.appear(function() { 3028 EUTHEM.basicElements.progressBarsInit( $element ); 3029 }); 3030 } 3031 }); 3032 }, 3033 progressBarsInit: function( $element ){ 3034 var val = $element.attr('data-value'), 3035 percentage = $('<span class="eut-percentage">'+ val + '%'+'</span>'); 3036 3037 $element.find('.eut-bar-line').animate({ width: val + '%' }, 1600); 3038 if( $element.parent().hasClass('eut-style-1') ) { 3039 percentage.appendTo($element.find('.eut-bar')).animate({ left: val + '%' }, 1600); 3040 } else { 3041 percentage.appendTo($element.find('.eut-bar-title')); 3042 } 3043 }, 3044 counter: function(){ 3045 if( bodyLoader === true ){ 3046 return; 3047 } 3048 var selector = '.eut-counter-item span'; 3049 $(selector).each(function(i){ 3050 var elements = $(selector)[i], 3051 thousandsSeparator = $(this).attr('data-thousands-separator') !== '' ? $(this).attr('data-thousands-separator') : ','; 3052 $(elements).attr('id','eut-counter-' + i );
3053 var delay = $(this).parents('.eut-counter').attr('data-delay') !== '' ? parseInt( $(this).parents('.eut-counter').attr('data-delay') ) : 200, 3054 options = { 3055 useEasing : true, 3056 useGrouping : true, 3057 separator : $(this).attr('data-thousands-separator-vis') !== 'yes' ? thousandsSeparator : '', 3058 decimal : $(this).attr('data-decimal-separator') !== '' ? $(this).attr('data-decimal-separator') : '.', 3059 prefix : $(this).attr('data-prefix') !== '' ? $(this).attr('data-prefix') : '', 3060 suffix : $(this).attr('data-suffix') !== '' ? $(this).attr('data-suffix') : '' 3061 }, 3062 counter = new CountUp( $(this).attr('id') , $(this).attr('data-start-val'), $(this).attr('data-end-val'), $(this).attr('data-decimal-points'), 2.5, options); 3063 $(this).appear(function() { 3064 setTimeout(function () { 3065 counter.start(); 3066 }, delay); 3067 }); 3068 }); 3069 }, 3070 slider: function(){ 3071 3072 var $element = $('#eut-main-content .eut-slider-element, #eut-single-media .eut-slider-element'); 3073 3074 $element.each(function(){ 3075 var $slider = $(this), 3076 $nextNav = $slider.parents('.eut-slider').find('.eut-carousel-next'), 3077 $prevNav = $slider.parents('.eut-slider').find('.eut-carousel-prev'), 3078 sliderSpeed = ( parseInt( $slider.attr('data-slider-speed') ) ) ? parseInt( $slider.attr('data-slider-speed') ) : 3000, 3079 transition = $slider.attr('data-slider-transition'), 3080 loop = $slider.attr('data-slider-loop') != 'no' ? true : false, 3081 autoPlay = $slider.attr('data-slider-autoplay') != 'no' ? true : false, 3082 autoHeight = $slider.attr('data-slider-autoheight') == 'yes' ? true : false, 3083 paginColor = $slider.attr('data-pagination-color') !== undefined ? 'eut-carousel-pagination eut-dots-' + $slider.attr('data-pagination-color') : 'eut-carousel-pagination', 3084 pagination = $slider.attr('data-pagination') != 'no' ? true : false, 3085 animateOut = false, 3086 animateIn = false; 3087 3088 // Slider Trantition 3089 if( $slider.parents('.eut-slider').hasClass('eut-layout-2') || 'fade' == transition ){ 3090 animateOut = 'carousel-fade-out'; 3091 animateIn = 'carousel-fade-in'; 3092 } 3093 3094 if ( $slider.find('.eut-slider-item').length == 1 ) { 3095 loop = false; 3096 } 3097 3098 // Slider Init 3099 $slider.owlCarousel({ 3100 items : 1, 3101 loop : loop, 3102 autoplay : autoPlay, 3103 autoplayTimeout : sliderSpeed, 3104 autoplayHoverPause : false, 3105 smartSpeed : 500, 3106 dots : pagination, 3107 animateOut : animateOut, 3108 animateIn : animateIn, 3109 autoHeight : autoHeight, 3110 dotsClass : paginColor, 3111 itemClass : 'eut-slider-item-wrapper' 3112 }); 3113 3114 $slider.parents('.eut-slider').css('visibility','visible'); 3115 3116 // Go to the next item 3117 $nextNav.on( 'click', function() { 3118 $slider.trigger('next.owl.carousel'); 3119 }); 3120 // Go to the previous item 3121 $prevNav.on( 'click', function() { 3122 $slider.trigger('prev.owl.carousel'); 3123 }); 3124 3125 }); 3126 3127 }, 3128 testimonial: function(){ 3129 3130 var $element = $('.eut-testimonial.eut-carousel-element'); 3131 3132 $element.each(function(){ 3133 var $testimonial = $(this), 3134 sliderSpeed = ( parseInt( $testimonial.attr('data-slider-speed') ) ) ? parseInt( $testimonial.attr('data-slider-speed') ) : 3000, 3135 pagination = $testimonial.attr('data-pagination') != 'no' ? true : false, 3136 paginationSpeed = ( parseInt( $testimonial.attr('data-pagination-speed') ) ) ? parseInt( $testimonial.attr('data-pagination-speed') ) : 400, 3137 transition = $testimonial.attr('data-slider-transition'), 3138 autoHeight = $testimonial.attr('data-slider-autoheight') == 'yes' ? true : false, 3139 autoPlay = $testimonial.attr('data-slider-autoplay') != 'no' ? true : false, 3140 sliderPause = $testimonial.attr('data-slider-pause') == 'yes' ? true : false, 3141 loop = true, 3142 animateOut = false, 3143 animateIn = false; 3144 3145 // Testimonial Trantition 3146 if( $testimonial.hasClass('eut-layout-2') || 'fade' == transition ){ 3147 animateOut = 'carousel-fade-out'; 3148 animateIn = 'carousel-fade-in'; 3149 } 3150 if ( $testimonial.find('.eut-testimonial-element').length == 1 ) { 3151 loop = false;
3152 } 3153 3154 // Testimonial Init 3155 $testimonial.owlCarousel({ 3156 items : 1, 3157 loop : loop, 3158 autoplay : autoPlay, 3159 autoplayTimeout : sliderSpeed, 3160 autoplayHoverPause : sliderPause, 3161 smartSpeed : 500, 3162 dots : pagination, 3163 dotsClass : 'eut-carousel-pagination', 3164 animateOut : animateOut, 3165 animateIn : animateIn, 3166 autoHeight : autoHeight, 3167 itemClass : 'eut-testimonial-item-wrapper' 3168 }); 3169 3170 $testimonial.css('visibility','visible'); 3171 3172 }); 3173 }, 3174 flexibleCarousel: function(){ 3175 3176 var $element = $('.eut-flexible-carousel-element'); 3177 3178 $element.each(function(){ 3179 3180 var $carousel = $(this), 3181 $nextNav = $carousel.parents('.eut-flexible-carousel').find('.eut-carousel-next'), 3182 $prevNav = $carousel.parents('.eut-flexible-carousel').find('.eut-carousel-prev'), 3183 sliderSpeed = ( parseInt( $carousel.attr('data-slider-speed') ) ) ? parseInt( $carousel.attr('data-slider-speed') ) : 3000, 3184 pagination = $carousel.attr('data-pagination') != 'no' ? true : false, 3185 paginationSpeed = ( parseInt( $carousel.attr('data-pagination-speed') ) ) ? parseInt( $carousel.attr('data-pagination-speed') ) : 400, 3186 autoHeight = $carousel.attr('data-slider-autoheight') == 'yes' ? true : false, 3187 autoPlay = $carousel.attr('data-slider-autoplay') != 'no' ? true : false, 3188 sliderPause = $carousel.attr('data-slider-pause') == 'yes' ? true : false, 3189 loop = true, 3190 itemNum = parseInt( $carousel.attr('data-items')), 3191 tabletLandscapeNum = $carousel.attr('data-items-tablet-landscape') ? parseInt( $carousel.attr('data-items-tablet-landscape')) : 4, 3192 tabletPortraitNum = $carousel.attr('data-items-tablet-portrait') ? parseInt( $carousel.attr('data-items-tablet-portrait')) : 2, 3193 mobileNum = $carousel.attr('data-items-mobile') ? parseInt( $carousel.attr('data-items-mobile')) : 1, 3194 gap = $carousel.parents('.eut-flexible-carousel').hasClass('eut-with-gap') ? 30 : 0, 3195 padding = $carousel.parents('.eut-flexible-carousel').hasClass('eut-with-gap') && $carousel.parents('.eut-section').hasClass('eut-fullwidth') ? 30 : 0; 3196 3197 if ( $carousel.find('.eut-flexible-carousel-element').length == 1 ) { 3198 loop = false; 3199 } 3200 // Carousel Init 3201 $carousel.owlCarousel({ 3202 items : 1, 3203 loop : loop, 3204 autoplay : autoPlay, 3205 autoplayTimeout : sliderSpeed, 3206 autoplayHoverPause : sliderPause, 3207 smartSpeed : 500, 3208 dots : pagination, 3209 dotsClass : 'eut-carousel-pagination', 3210 responsive : { 3211 0 : { 3212 items : mobileNum 3213 }, 3214 768 : { 3215 items : tabletPortraitNum 3216 }, 3217 1024 : { 3218 items : tabletLandscapeNum 3219 }, 3220 1200 : { 3221 items : itemNum 3222 } 3223 }, 3224 margin : gap, 3225 stagePadding : padding, 3226 autoHeight : autoHeight, 3227 itemClass : 'eut-carousel-item-wrapper' 3228 }); 3229 3230 $carousel.css('visibility','visible'); 3231 3232 // Go to the next item 3233 $nextNav.on( 'click', function() { 3234 $carousel.trigger('next.owl.carousel'); 3235 }); 3236 // Go to the previous item 3237 $prevNav.on( 'click', function() { 3238 $carousel.trigger('prev.owl.carousel'); 3239 }); 3240 3241 }); 3242 }, 3243 carousel: function(){ 3244 3245 var $element = $('.eut-carousel-element'); 3246 3247 $element.each(function(){ 3248 var $carousel = $(this), 3249 $nextNav = $carousel.parents('.eut-carousel').find('.eut-carousel-next'), 3250 $prevNav = $carousel.parents('.eut-carousel').find('.eut-carousel-prev'), 3251 sliderSpeed = ( parseInt( $carousel.attr('data-slider-speed') ) ) ? parseInt( $carousel.attr('data-slider-speed') ) : 3000, 3252 pagination = $carousel.attr('data-pagination') != 'no' ? true : false, 3253 paginationSpeed = ( parseInt( $carousel.attr('data-pagination-speed') ) ) ? parseInt( $carousel.attr('data-pagination-speed') ) : 400, 3254 autoHeight = $carousel.attr('data-slider-autoheight') == 'yes' ? true : false, 3255 autoPlay = $carousel.attr('data-slider-autoplay') != 'no' ? true : false, 3256 sliderPause = $carousel.attr('data-slider-pause') == 'yes' ? true : false, 3257 loop = $carousel.attr('data-slider-loop') != 'no' ? true : false, 3258 itemNum = parseInt( $carousel.attr('data-items')), 3259 tabletLandscapeNum = $carousel.attr('data-items-tablet-landscape') ? parseInt( $carousel.attr('data-items-tablet-landscape')) : 3, 3260 tabletPortraitNum = $carousel.attr('data-items-tablet-portrait') ? parseInt( $carousel.attr('data-items-tablet-portrait')) : 3, 3261 mobileNum = $carousel.attr('data-items-mobile') ? parseInt( $carousel.attr('data-items-mobile')) : 1, 3262 gap = $carousel.parents('.eut-carousel').hasClass('eut-with-gap') && !isNaN( $carousel.data('gutter-size') ) ? Math.abs( $carousel.data('gutter-size') )
3262: 0, 3263 padding = $carousel.parents('.eut-carousel').hasClass('eut-with-gap') && $carousel.parents('.eut-section').hasClass('eut-fullwidth') && !isNaN( $carousel.data('gutter-size') ) ? Math.abs( $carousel.data('gutter-size') ) : 0; 3264 3265 if ( $carousel.find('.eut-carousel-item').length == 1 ) { 3266 loop = false; 3267 } 3268 3269 // Carousel Init 3270 $carousel.owlCarousel({ 3271 loop : loop, 3272 autoplay : autoPlay, 3273 autoplayTimeout : sliderSpeed, 3274 autoplayHoverPause : sliderPause, 3275 smartSpeed : 500, 3276 dots : pagination, 3277 dotsClass : 'eut-carousel-pagination', 3278 responsive : { 3279 0 : { 3280 items : mobileNum 3281 }, 3282 768 : { 3283 items : tabletPortraitNum 3284 }, 3285 1024 : { 3286 items : tabletLandscapeNum 3287 }, 3288 1200 : { 3289 items : itemNum 3290 } 3291 }, 3292 margin : gap, 3293 stagePadding : padding, 3294 itemClass : 'eut-carousel-item-wrapper' 3295 }); 3296 3297 $carousel.css('visibility','visible'); 3298 3299 // Go to the next item 3300 $nextNav.on( 'click', function() { 3301 $carousel.trigger('next.owl.carousel'); 3302 }); 3303 // Go to the previous item 3304 $prevNav.on( 'click', function() { 3305 $carousel.trigger('prev.owl.carousel'); 3306 }); 3307 3308 }); 3309 }, 3310 advancedCarousel: function(){ 3311 3312 var $element = $('.eut-advanced-carousel'); 3313 3314 $element.each(function(){ 3315 var $carousel = $(this), 3316 sliderSpeed = ( parseInt( $carousel.attr('data-slider-speed') ) ) ? parseInt( $carousel.attr('data-slider-speed') ) : 3000, 3317 pagination = $carousel.attr('data-pagination') != 'no' ? true : false, 3318 paginationSpeed = ( parseInt( $carousel.attr('data-pagination-speed') ) ) ? parseInt( $carousel.attr('data-pagination-speed') ) : 400, 3319 autoHeight = $carousel.attr('data-slider-autoheight') == 'yes' ? true : false, 3320 autoPlay = $carousel.attr('data-slider-autoplay') != 'no' ? true : false, 3321 sliderPause = $carousel.attr('data-slider-pause') == 'yes' ? true : false, 3322 loop = $carousel.attr('data-slider-loop') != 'no' ? true : false, 3323 gap = $carousel.parents('.eut-carousel').hasClass('eut-with-gap') && !isNaN( $carousel.data('gutter-size') ) ? Math.abs( $carousel.data('gutter-size') ) : 0, 3324 largeScreenStagePadding = !isNaN( $carousel.data('stage-padding-large-screen') ) ? Math.abs( $carousel.data('stage-padding-large-screen') ) : 0, 3325 stagePadding = !isNaN( $carousel.data('stage-padding') ) ? Math.abs( $carousel.data('stage-padding') )
3325: 0, 3326 tabletLandscapeStagePadding = !isNaN( $carousel.data('stage-padding-tablet-landscape') ) ? Math.abs( $carousel.data('stage-padding-tablet-landscape') ) : 0, 3327 tabletPortraitStagePadding = !isNaN( $carousel.data('stage-padding-tablet-portrait') ) ? Math.abs( $carousel.data('stage-padding-tablet-portrait') ) : 0, 3328 mobileStagePadding = !isNaN( $carousel.data('stage-padding-mobile') ) ? Math.abs( $carousel.data('stage-padding-mobile') ) : 0; 3329 3330 if ( $carousel.find('.eut-carousel-item').length == 1 ) { 3331 loop = false; 3332 } 3333 3334 // Carousel Init 3335 $carousel.owlCarousel({ 3336 loop : loop, 3337 autoplay : autoPlay, 3338 autoplayTimeout : sliderSpeed, 3339 autoplayHoverPause : sliderPause, 3340 smartSpeed : 500, 3341 dots : pagination, 3342 dotsClass : 'eut-carousel-pagination', 3343 items : 1, 3344 margin : gap, 3345 responsive:{ 3346 0:{ 3347 items:1, 3348 stagePadding: mobileStagePadding 3349 }, 3350 768:{ 3351 items:1, 3352 stagePadding: tabletPortraitStagePadding 3353 }, 3354 1024:{ 3355 items:1, 3356 stagePadding: tabletLandscapeStagePadding 3357 }, 3358 1200:{ 3359 items:1, 3360 stagePadding: stagePadding 3361 }, 3362 2000:{ 3363 items:1, 3364 stagePadding: largeScreenStagePadding 3365 } 3366 }, 3367 itemClass : 'eut-carousel-item-wrapper' 3368 }); 3369 3370 $carousel.css('visibility','visible'); 3371 3372 }); 3373 }, 3374 advancedPromo: function(){ 3375 var $item = $('.eut-expandable-info'); 3376 $item.each(function(){ 3377 var $that = $(this), 3378 $wrapper = $that.parents('.eut-section'), 3379 $content = $that.find('.eut-expandable-info-content'), 3380 paddingTop = parseInt( $wrapper.css('padding-top') ), 3381 paddingBottom = parseInt( $wrapper.css('padding-bottom') ); 3382 3383 $wrapper.addClass('eut-pointer-cursor'); 3384 $wrapper.on('click',function(){ 3385 3386 var headerHeight = $('#eut-header').data('sticky') != 'none' ? $('#eut-main-header').outerHeight() : 0, 3387 fieldBarHeight = $('.eut-fields-bar').length ? $('.eut-fields-bar').outerHeight() : 0, 3388 offset = $(this).offset().top, 3389 distance = offset - ( headerHeight + fieldBarHeight ); 3390 3391 if( $content.is(":visible") ){ 3392 $content.slideUp( 600, function(){ 3393 $content.removeClass('show'); 3394 }); 3395 } else { 3396 3397 $('html,body').animate({ 3398 scrollTop: distance 3399 }, 600,function(){ 3400 $content.slideDown( function(){ 3401 $content.addClass('show'); 3402 return; 3403 }); 3404 }); 3405 } 3406 }); 3407 $wrapper.mouseenter(function() { 3408 $(this).css({ 'padding-top' : paddingTop + 40, 'padding-bottom' : paddingBottom + 40 }); 3409 }); 3410 $wrapper.mouseleave(function() { 3411 $(this).css({ 'padding-top' : paddingTop, 'padding-bottom' : paddingBottom }); 3412 }); 3413 }); 3414 }, 3415 doubleImageText: function(){ 3416 var $el = $('.eut-double-image-text'), 3417 $paraller = $el.find('.eut-paraller'); 3418 3419 imagesLoaded( $el, function() { 3420 $paraller.paraller({ 3421 wrapper : '.eut-paraller-wrapper', 3422 invert : false, 3423 tabletL : [1200, true], 3424 tabletP : [1023, true], 3425 mobileL : [767, false] 3426 }); 3427 }); 3428 }, 3429 portfolioParallax: function(){ 3430 var $el = $('.eut-portfolio-crocal-style'), 3431 $paraller = $el.find('.eut-paraller'); 3432 3433 imagesLoaded( $el, function() { 3434 $paraller.paraller({ 3435 wrapper : '.eut-paraller-wrapper', 3436 invert : false, 3437 tabletL : [1200, true], 3438 tabletP : [1023, true], 3439 mobileL : [767, false] 3440 }); 3441 }); 3442 }, 3443 teamParallax: function(){ 3444 var $el = $('.eut-team.eut-layout-2'), 3445 $paraller = $el.find('.eut-paraller'); 3446 3447 imagesLoaded( $el, function() { 3448 $paraller.paraller({ 3449 wrapper : '.eut-paraller-wrapper', 3450 invert : false, 3451 tabletL : [1200, true], 3452 tabletP : [1023, true], 3453 mobileL : [767, false] 3454 }); 3455 }); 3456 }, 3457 testimonialParallax: function(){ 3458 var $el = $('.eut-testimonial.eut-layout-2'), 3459 $paraller = $el.find('.eut-paraller'); 3460 3461 imagesLoaded( $el, function() { 3462 $paraller.paraller({ 3463 wrapper : '.eut-paraller-wrapper', 3464 invert : false, 3465 tabletL : [1200, true], 3466 tabletP : [1023, true], 3467 mobileL : [767, false] 3468 }); 3469 }); 3470 }, 3471 iconBox: function(){ 3472 var $iconBox = $('.eut-box-icon.eut-advanced-hover'); 3473 if( isMobile.any() ) { 3474 $iconBox.css({'visibility' : 'visible'}); 3475 return false;
3476 } 3477 $iconBox.each(function(){ 3478 var $that = $(this), 3479 $text = $that.find('p'), 3480 $column = $that.parents('.eut-column'), 3481 space = 0, 3482 resize = false; 3483 3484 setup(); 3485 $(window).smartresize(setup); 3486 3487 function updateParams(){ 3488 space = $text.outerHeight(); 3489 } 3490 3491 function resetIcon(){ 3492 $that.css({ 'top' : '' }); 3493 $text.css({ 'opacity' : 1, 'bottom' : '' }); 3494 } 3495 3496 function setup(){ 3497 if(!resize){ 3498 resize = true; 3499 3500 resetIcon(); 3501 updateParams(); 3502 3503 $column.css({ 'overflow' : 'hidden' }); 3504 $that.css({ 'top' : space, 'visibility' : 'visible' }); 3505 $text.css({ 'opacity' : 0, 'position' : 'relative', 'bottom' : '-120%' }); 3506 3507 resize = true; 3508 } 3509 } 3510 3511 $column.hover(function(){ 3512 $that.stop( true, true ).animate({ 3513 'top' : 0 3514 },400, 'easeOutBack'); 3515 $text.stop( true, true ).delay( 100 ).animate({ 3516 'opacity' : 1, 3517 'bottom' : 0 3518 },600, 'easeOutBack'); 3519 },function(){ 3520 $that.stop( true, true ).animate({ 3521 'top' : space 3522 },500, 'easeOutBack'); 3523 $text.stop( true, true ).animate({ 3524 'opacity' : 0, 3525 'bottom' : '-120%' 3526 },400, 'easeOutBack'); 3527 }); 3528 3529 }); 3530 3531 }, 3532 messageBox: function(){ 3533 var infoMessage = $('.eut-message'), 3534 closeBtn = infoMessage.find($('.eut-close')); 3535 closeBtn.on( 'click', function() { 3536 $(this).parent().slideUp(150); 3537 }); 3538 }, 3539 wooProduct: function(){ 3540 var $item = $('.eut-product-item'), 3541 $addBtn = $item.find('.add_to_cart_button'); 3542 $addBtn.on('click',function(){ 3543 $(this).parents('.eut-product-item').addClass('eut-product-added'); 3544 }); 3545 }, 3546 animAppear: function(){ 3547 if( bodyLoader || $('body').hasClass('page-template-template-full-page') ){ 3548 return; 3549 } 3550 if( isMobile.any() && !deviceAnimAppear ) { 3551 $('.eut-animated-item').css('opacity',1); 3552 } else { 3553 $('.eut-animated-item').each(function() { 3554 var $that = $(this), 3555 timeDelay = $that.attr('data-delay'); 3556 3557 if( $that.parents('.eut-clipping-animation').length ) return; 3558 3559 $that.appear(function() { 3560 setTimeout(function () { 3561 $that.addClass('eut-animated'); 3562 }, timeDelay); 3563 },{accX: 0, accY: -150}); 3564 }); 3565 } 3566 }, 3567 htmlVideoPlayWhenAppear: function(){ 3568 var $video = $('.eut-embed-video'); 3569 $video.each(function(){ 3570 var $that = $(this); 3571 $that[0].pause(); 3572 $that.appear(function(){ 3573 if( $that[0].autoplay ){ 3574 $that[0].play(); 3575 } 3576 },{accX: 0, accY: -150}); 3577 }); 3578 }, 3579 accordionToggle: function(){ 3580 $('.eut-accordion-wrapper.eut-action-toggle').on('click', '.eut-title-wrapper', function(){ 3581 var $that = $(this), 3582 gototop = $that.parents('.eut-accordion').attr('data-gototop') == 'yes' ? true : false; 3583 3584 $that 3585 .toggleClass('active') 3586 .next().slideToggle(350, function(){ 3587 // Go to top 3588 if ( gototop ) { 3589 EUTHEM.pageSettings.linkGoToTop( $that.parent(), 300, 30 ); 3590 } 3591 }); 3592 if( $(this).parent().find('.eut-isotope').length ) { 3593 setTimeout(function(){ 3594 EUTHEM.isotope.relayout(); 3595 },100); 3596 } 3597 }); 3598 $('.eut-accordion-wrapper.eut-action-accordion').on('click', '.eut-title-wrapper', function(){ 3599 var $that = $(this), 3600 gototop = $that.parents('.eut-accordion').attr('data-gototop') == 'yes' ? true : false; 3601 3602 $that 3603 .toggleClass('active').next().slideToggle(350) 3604 .parent().siblings().find('.eut-title-wrapper').removeClass('active') 3605 .next().slideUp(350,function(){ 3606 // Go to top 3607 if ( gototop ) { 3608 EUTHEM.pageSettings.linkGoToTop( $that.parent(), 300, 30 ); 3609 } 3610 }); 3611 if( $(this).parent().find('.eut-isotope').length ) { 3612 setTimeout(function(){ 3613 EUTHEM.isotope.relayout(); 3614 },100); 3615 } 3616 // Recalculate Section Height 3617 if( $that.parents('.eut-section').hasClass('eut-percentage-height') || $that.parents('.eut-section').find('.eut-percentage-height').length ) { 3618 var $parent = $that.parents('.eut-section'); 3619 setTimeout(function(){ 3620 EUTHEM.sectionHeight.resetHeight( $parent[0] ); 3621 },400); 3622 } 3623 }); 3624 }, 3625 tabs: function(){ 3626 $('.eut-tab-title').on( 'click', function() { 3627 var $that = $(this), 3628 contentId = $that.data('rel'), 3629 gototop = $that.parents('.eut-tab').attr('data-gototop') == 'yes' ? true : false;
3630 $that.parents('.eut-tab').find('.eut-tab-title').removeClass('active'); 3631 $that.addClass('active'); 3632 $that.parents('.eut-tab').find('.eut-tab-content').removeClass('active'); 3633 $that.parents('.eut-tab').find(contentId).addClass('active'); 3634 if( $that.parents('.eut-tab').find('.eut-tab-content').find('.eut-isotope').length ) { 3635 setTimeout(function(){ 3636 EUTHEM.isotope.relayout(); 3637 },100); 3638 } 3639 3640 // Recalculate Section Height 3641 if( $that.parents('.eut-section').hasClass('eut-percentage-height') || $that.parents('.eut-section').find('.eut-percentage-height').length ) { 3642 var $parent = $that.parents('.eut-section'); 3643 EUTHEM.sectionHeight.resetHeight( $parent[0] ); 3644 } 3645 // Go to top 3646 if ( gototop ) { 3647 EUTHEM.pageSettings.linkGoToTop( $that.parent(), 300, 30 ); 3648 } 3649 }); 3650 }, 3651 productSocials: function(){ 3652 var $socials = $('.eut-product-social'), 3653 $item = $socials.find('li'); 3654 if( !$socials.length ) return; 3655 3656 $socials.appear(function() { 3657 $item.each(function(i,n){ 3658 var $this = $(this); 3659 setTimeout(function(){ 3660 $this.addClass('eut-animated'); 3661 },150 * i); 3662 }); 3663 },{accX: 0, accY: -50}); 3664 }, 3665 countdown: function(){ 3666 $('.eut-countdown').each(function() { 3667 var $this = $(this), 3668 finalDate = $this.data('countdown'), 3669 numbersSize = $this.data('numbers-size'), 3670 textSize = $this.data('text-size'), 3671 numbersColor = $this.data('numbers-color'), 3672 textColor = $this.data('text-color'), 3673 countdownItems = '', 3674 text = '', 3675 countdownFormat = $this.data('countdown-format').split('|'); 3676 3677 $.each( countdownFormat, function( index, value ) { 3678 switch (value) { 3679 case 'w': 3680 text = crocal_eutf_main_data.string_weeks; 3681 break; 3682 case 'D': 3683 case 'd': 3684 case 'n': 3685 text = crocal_eutf_main_data.string_days; 3686 break; 3687 case 'H': 3688 text = crocal_eutf_main_data.string_hours; 3689 break; 3690 case 'M': 3691 text = crocal_eutf_main_data.string_minutes; 3692 break; 3693 case 'S': 3694 text = crocal_eutf_main_data.string_seconds; 3695 break; 3696 default: 3697 text = ''; 3698 } 3699 countdownItems += '<div class="eut-countdown-item">'; 3700 countdownItems += '<div class="eut-number eut-' + numbersSize + ' eut-text-' + numbersColor + '">%' + value + '</div>'; 3701 countdownItems += '<span class="eut-' + textSize + ' eut-text-' + textColor + '">
3701' + text + '</span>'; 3702 countdownItems += '</div>'; 3703 3704 }); 3705 3706 $this.countdown(finalDate, function(event) { 3707 $this = $(this).html(event.strftime( countdownItems )); 3708 }); 3709 }); 3710 }, 3711 hovers: function(){ 3712 var hoverItem = '.eut-image-hover'; 3713 if( isMobile.any() && '0' === crocal_eutf_main_data.device_hover_single_tap ) { 3714 var touchevent = 'touchend'; 3715 if( $(hoverItem).parent().parent().hasClass('eut-carousel-item') ) { 3716 touchevent = 'touchstart'; 3717 } 3718 $('body').on(touchevent, hoverItem, function(e) { 3719 var $item = $(this); 3720 if ( !$item.hasClass('hover') ) { 3721 $item.addClass('hover'); 3722 $(hoverItem).not(this).removeClass('hover'); 3723 e.preventDefault(); 3724 } 3725 }); 3726 $(document).on('touchstart touchend', function(e) { 3727 if ( !$(hoverItem).is(e.target) && $(hoverItem).has(e.target).length === 0 ) { 3728 $(hoverItem).removeClass('hover'); 3729 } 3730 }); 3731 } else { 3732 $('body').on('mouseenter mouseleave', hoverItem, function() { 3733 $(this).toggleClass('hover'); 3734 }); 3735 } 3736 } 3737 }; 3738 3739 // # Parallax Section 3740 // ============================================================================= // 3741 EUTHEM.parallaxSection = { 3742 init : function( section ){ 3743 var $section = $(section); 3744 $section.bgParallax(); 3745 } 3746 }; 3747 3748 // # Section Settings 3749 // ============================================================================= // 3750 EUTHEM.sectionSettings = { 3751 3752 init: function(){ 3753 EUTHEM.sectionSettings.expandColumnBg(); 3754 3755 if( $('#eut-sidebar').length === 0 ) return; 3756 3757 var section = '#eut-content .eut-section', 3758 windowWidth = $(window).width(), 3759 themeWidth = $('#eut-theme-wrapper').width(), 3760 wrapperWidth = $('.eut-content-wrapper').width(), 3761 contentWidth = $('#eut-main-content').width(), 3762 sidebarWidth = $('#eut-sidebar').outerWidth(), 3763 space = (themeWidth - wrapperWidth)/2, 3764 sidebarSpace = space + wrapperWidth - contentWidth; 3765 3766 3767 $(section).each(function(){ 3768 var $section = $(this); 3769 if( $section.hasClass('eut-fullwidth-background') ){ 3770 fullBg($section); 3771 } 3772 if( $section.hasClass('eut-fullwidth') ){ 3773 fullElement($section); 3774 } 3775 3776 }); 3777 3778 function fullBg( section ) { 3779 if( windowWidth + scrollBarWidth >= tabletPortrait ) { 3780 if( $('.eut-right-sidebar').length ) { 3781 section.css({ 'visibility': 'visible', 'padding-left':space, 'padding-right': sidebarSpace, 'margin-left': -space, 'margin-right': -sidebarSpace}); 3782 } 3783 else { 3784 section.css({ 'visibility': 'visible', 'padding-left':sidebarSpace, 'padding-right': space, 'margin-left': -sidebarSpace, 'margin-right': -space}); 3785 } 3786 } else { 3787 section.css({ 'visibility': 'visible', 'padding-left':'', 'padding-right': '', 'margin-left': '', 'margin-right': ''}); 3788 } 3789 3790 } 3791 3792 function fullElement( section ) { 3793 if( windowWidth + scrollBarWidth >= tabletPortrait ) { 3794 if( $('.eut-right-sidebar').length ) { 3795 section.css({ 'visibility': 'visible', 'padding-left':0, 'padding-right': sidebarSpace, 'margin-left': -space, 'margin-right': -sidebarSpace}); 3796 } 3797 else { 3798 section.css({ 'visibility': 'visible', 'padding-left':sidebarSpace, 'padding-right': 0, 'margin-left': -sidebarSpace, 'margin-right': -space}); 3799 } 3800 } else { 3801 section.css({ 'visibility': 'visible', 'padding-left':'', 'padding-right': '', 'margin-left': -space, 'margin-right': -space}); 3802 } 3803 } 3804 }, 3805 expandColumnBg: function(){ 3806 var $column = $('.eut-expand-bg'); 3807 $column.each(function(){ 3808 var $that = $(this), 3809 $inner = $that.children(), 3810 direction = 'left'; 3811 if( $that.hasClass('eut-expand-bg-right') ) { 3812 direction = 'right'; 3813 } 3814 3815 EUTHEM.sectionSettings.expandSettings( $that, $inner, direction ); 3816 if( $that.hasClass('eut-clipping-animation') ) { 3817 var $innerWrapper = $that.find('.eut-clipping-content').children(); 3818 EUTHEM.sectionSettings.expandSettings( $that, $innerWrapper, direction ); 3819 } 3820 3821 }); 3822 }, 3823 expandSettings: function( $that, $element, direction ){ 3824 resetExpandBg(); 3825 3826 var positionL = $element.offset().left, 3827 positionR = $(window).width() - (positionL + $element.width()), 3828 windowWidth = $(window).width(); 3829 3830 if ( windowWidth > tabletPortrait && windowWidth < tabletLandscape && $that.hasClass('eut-tablet-landscape-reset-expand-bg') ) { 3831 resetExpandBg(); 3832 } else if ( windowWidth > mobileScreen && windowWidth < tabletPortrait && $that.hasClass('eut-tablet-portrait-reset-expand-bg') ) { 3833 resetExpandBg(); 3834 } else if( windowWidth < mobileScreen && $that.hasClass('eut-mobile-reset-expand-bg') ) { 3835 resetExpandBg(); 3836 } else { 3837 expandBg(); 3838 } 3839 3840 function expandBg() { 3841 if( 'left' == direction ) { 3842 $element[0].style.cssText += 'padding-left: ' + positionL + 'px !important'; 3843 $element[0].style.cssText += 'margin-left: -' + positionL + 'px !important'; 3844 $element[0].style.cssText += 'width: auto'; 3845 } else { 3846 $element[0].style.cssText += 'padding-right: ' + positionR + 'px !important'; 3847 $element[0].style.cssText += 'margin-right: -' + positionR + 'px !important'; 3848 $element[0].style.cssText += 'width: auto'; 3849 } 3850 } 3851 3852 function resetExpandBg() { 3853 $element.css({ 3854 'margin-left' : '', 3855 'margin-right' : '', 3856 'padding-left' : '', 3857 'padding-right' : '', 3858 'width': '' 3859 }); 3860 } 3861 3862 $that.css('visibility','visible'); 3863 } 3864 }; 3865 3866 // # Isotope 3867 // ============================================================================= // 3868 EUTHEM.isotope = { 3869 init: function(){ 3870 $('.eut-isotope').each(function(){ 3871 var $wrapper = $(this), 3872 $container = $wrapper.find('.eut-isotope-container'), 3873 itemsArr = $.makeArray( $container.find('.eut-isotope-item') ), 3874 layoutMode = $wrapper.data('layout'), 3875 $pagination = $wrapper.find('.eut-infinite-pagination'), 3876 displayStyle = $wrapper.data('display-style'); 3877
3878 $container.imagesLoaded().always( function( instance ) { 3879 3880 EUTHEM.isotope.updateSettings( $wrapper ); 3881 3882 $container.isotope({ 3883 itemSelector: '.eut-isotope-item', 3884 layoutMode: layoutMode, 3885 transitionDuration: 0, 3886 masonry: { 3887 columnWidth: EUTHEM.isotope.getColumnWidth( $wrapper ) 3888 } 3889 }); 3890 3891 // Recalculate Section Height 3892 if( $wrapper.parents('.eut-section').hasClass('eut-percentage-height') || $wrapper.parents('.eut-section').find('.eut-percentage-height').length) { 3893 var $parent = $wrapper.parents('.eut-section'); 3894 EUTHEM.sectionHeight.resetHeight( $parent[0] ); 3895 } 3896 3897 $container.css('visibility','visible'); 3898 3899 // Isotope Items Animation 3900 $wrapper.appear(function() { 3901 EUTHEM.isotope.itemsAnimation( itemsArr ); 3902 }); 3903 }); 3904 3905 3906 // Filters 3907 var filterArr = [], 3908 $filters = $wrapper.find('.eut-filter'), 3909 $filter = $filters.find('li'); 3910 3911 $filter.each(function(){ 3912 var selector = $(this).data('filter'); 3913 if( filterArr.indexOf(selector) === -1 ) { 3914 filterArr.push(selector); 3915 } 3916 }); 3917 3918 $filters.on('click', 'li', function(){ 3919 var selector = $(this).data('filter'), 3920 title = $(this).html(), 3921 $curCategory = $(this).parent().find('.eut-current-category'), 3922 gototop = $(this).parents('.eut-filter').attr('data-gototop') == 'yes' ? true : false; 3923 3924 if( $curCategory.length > 0 ){ 3925 $curCategory.find('span').html( title ); 3926 } 3927 3928 $container.isotope({ 3929 filter: selector 3930 }); 3931 3932 // Go to top 3933 if( 'infinite-scroll' !== displayStyle && 'load-more' !== displayStyle ) { 3934 if ( gototop ) { 3935 EUTHEM.pageSettings.linkGoToTop( $(this).parent(), 300, 30 ); 3936 } 3937 } 3938 $(this).addClass('selected').siblings().removeClass('selected'); 3939 }); 3940 3941 // Infinite Scroll 3942 if( $pagination.length ){ 3943 var scrollThresh = true; 3944 if ('load-more' == displayStyle ) { 3945 scrollThresh = false; 3946 } 3947 3948 var isotopeId = '#' + $wrapper.attr('id'), 3949 path = isotopeId + ' .eut-infinite-pagination .next', 3950 status = isotopeId + ' .eut-infinite-page-load', 3951 btn = isotopeId + ' .eut-infinite-button'; 3952 3953 $container.infiniteScroll({ 3954 path: path, 3955 history: false, 3956 status: status, 3957 button: btn, 3958 scrollThreshold: scrollThresh, 3959 }); 3960 3961 // append items on load 3962 $container.on( 'load.infiniteScroll', function( event, response, path ) { 3963 var items = $( response ).find( isotopeId +' .eut-isotope-item'), 3964 $filter = $( response ).find( isotopeId + ' .eut-filter ul li'), 3965 $filterList = $wrapper.find('.eut-filter ul'), 3966 activeCategory = $wrapper.find('.eut-filter .selected').data('filter'); 3967 3968 if( '*' !== activeCategory ) { 3969 var $filterAll = $wrapper.find('.eut-filter ul li[data-filter="*"]'); 3970 $filterAll.trigger('click'); 3971 } 3972 3973 // append items after images loaded 3974 items.imagesLoaded( function() { 3975 $container.append( items ); 3976 EUTHEM.isotope.itemSize( $wrapper, items ); 3977 $container.isotope( 'insert', items ); 3978 EUTHEM.isotope.isotopeReinitFunction( $container ); 3979 $(window).trigger('eut_isotope_append_items'); 3980 3981 EUTHEM.isotope.autoHeadings( $container ); 3982 3983 // Equal Columns 3984 EUTHEM.isotope.equalColumns( $wrapper, items ); 3985 $container.isotope( 'layout' ); 3986 3987 // New Items Animation 3988 EUTHEM.isotope.itemsAnimation( items ); 3989 3990 $filter.each(function(){ 3991 var $that = $(this), 3992 filterClass = $that.data('filter'); 3993 if( -1 === filterArr.indexOf( filterClass ) ) { 3994 filterArr.push( filterClass ); 3995 $that.appendTo($filterList); 3996 } 3997 }); 3998 }); 3999 }); 4000 } 4001 4002 }); 4003 }, 4004 isotopeReinitFunction: function( $container ){ 4005 EUTHEM.basicElements.slider(); 4006 EUTHEM.pageSettings.fitVid(); 4007 EUTHEM.pageSettings.bgLoader(); 4008 4009 // Recalculate Section Height 4010 if( $container.parents('.eut-section').hasClass('eut-percentage-height') || $container.parents('.eut-section').find('.eut-percentage-height').length) { 4011 var $parent = $container.parents('.eut-section'); 4012 EUTHEM.sectionHeight.resetHeight( $parent[0] ); 4013 } 4014 }, 4015 updateSettings: function( $wrapper ){ 4016 var $container = $wrapper.find('.eut-isotope-container'), 4017 itemsArr = $.makeArray( $container.find('.eut-isotope-item') ), 4018 layoutMode = $wrapper.data('layout'); 4019 4020 EUTHEM.isotope.containerSize( $wrapper ); 4021 EUTHEM.isotope.itemSize( $wrapper, itemsArr ); 4022 EUTHEM.isotope.autoHeadings( $container ); 4023 // Equal Columns 4024 EUTHEM.isotope.equalColumns( $wrapper, itemsArr ); 4025 }, 4026 autoHeadings: function( $container ){ 4027 var $postItem = $container.find('.eut-blog-item.eut-style-2 .eut-blog-item-inner'), 4028 $portfolioItem = $('.eut-portfolio.eut-auto-headings .eut-isotope-item-inner'), 4029 compressor = 10; 4030 4031 $postItem.each(function(){ 4032 var $that = $(this), 4033 $title = $that.find('.eut-post-title'); 4034 if( $that.parents('.eut-section').hasClass('eut-fullwidth')) { 4035 compressor = 20; 4036 } 4037 EUTHEM.isotope.setAutoHeadings( $that, $title, compressor ); 4038 }); 4039 $portfolioItem.each(function(){ 4040 var $that = $(this), 4041 $title = $that.find('.eut-title'); 4042 if( $that.parents('.eut-section').hasClass('eut-fullwidth')) { 4043 compressor = 20; 4044 } 4045 EUTHEM.isotope.setAutoHeadings( $that, $title, compressor ); 4046 }); 4047 }, 4048 setAutoHeadings:function( $item, $title, compressor ){ 4049 EUTHEM.isotope.resetAutoHeadings( $title ); 4050 var itemW = $item.width(), 4051 initFontSize = parseInt( $title.css('font-size') ), 4052 maxFontSize = 90, 4053 newSize = (Math.max( Math.min( itemW / compressor, parseFloat(maxFontSize) ), parseFloat(initFontSize) )).toFixed(0); 4054 $title.css({ 4055 'font-size' : newSize + 'px' 4056 }); 4057 }, 4058 resetAutoHeadings: function( $title ){ 4059 $title.css({ 4060 'font-size' : '' 4061 }); 4062 }, 4063 equalColumns: function( $wrapper, items ){ 4064 if( 'fitRows' != $wrapper.data('layout') || !$wrapper.hasClass('eut-blog') || $wrapper.hasClass('eut-blog-small') ) return; 4065 var $innerItems = $(items).find('.eut-isotope-item-inner'), 4066 maxHeight = 0; 4067 $innerItems.each(function(){ 4068 var $that = $(this), 4069 itemH = $that.css('height','auto').height(); 4070 if( itemH > maxHeight ) { 4071 maxHeight = itemH; 4072 } 4073 }); 4074 $innerItems.css( 'height', maxHeight ); 4075 }, 4076 relayout: function(){ 4077 $('.eut-isotope').each(function(){ 4078 var $wrapper = $(this), 4079 $container = $wrapper.find('.eut-isotope-container'); 4080 EUTHEM.isotope.updateSettings( $wrapper ); 4081 $container.isotope({ 4082 transitionDuration: 0 4083 }).isotope( 'layout' ); 4084 // Recalculate Section Height 4085 if( $wrapper.parents('.eut-section').hasClass('eut-percentage-height') || $wrapper.parents('.eut-section').find('.eut-percentage-height').length) { 4086 var $parent = $wrapper.parents('.eut-section'); 4087 EUTHEM.sectionHeight.resetHeight( $parent[0] ); 4088 } 4089 }); 4090 }, 4091 getColumnWidth: function( $wrapper ){ 4092 var gutter = !isNaN( $wrapper.data('gutter-size') ) ? Math.abs( $wrapper.data('gutter-size') )
4092: 0, 4093 columns = EUTHEM.isotope.getColumns( $wrapper ), 4094 wrapperW = $wrapper.innerWidth(), 4095 offset = $wrapper.parents('.eut-section').hasClass('eut-fullwidth') ? - gutter : gutter, 4096 columnW = (wrapperW + offset) / columns; 4097 columnW = (columnW % 1 !== 0) ? Math.ceil(columnW) : columnW; 4098 return columnW; 4099 }, 4100 itemSize: function( $wrapper, items ){ 4101 var gutter = !isNaN( $wrapper.data('gutter-size') ) ? Math.abs( $wrapper.data('gutter-size') ) : 0, 4102 columns = EUTHEM.isotope.getColumns( $wrapper ), 4103 columnW = EUTHEM.isotope.getColumnWidth( $wrapper ); 4104 4105 $.each( items, function(index, item){ 4106 var $item = $(item), 4107 $thumb = $item.find('.eut-thumbnail'); 4108 if( $item.hasClass('eut-image-landscape') ) { 4109 if ( columns != 1 && columns != 2) { 4110 $item.css({'width' : columnW * 2}); 4111 } else { 4112 $item.css({'width' : columnW }); 4113 } 4114 $thumb.removeAttr('style'); 4115 $thumb.css('height',columnW - gutter); 4116 } else if( $item.hasClass('eut-image-portrait') ) { 4117 $item.css({'width' : columnW }); 4118 $thumb.removeAttr('style'); 4119 $thumb.css('height',columnW*2 - gutter); 4120 } else { 4121 $item.css({'width' : columnW }); 4122 } 4123 if( $item.hasClass('eut-style-2') && $item.hasClass('eut-bg-size-double') && columns != 1 && columns != 2 ) { 4124 $item.css({'width' : columnW * 2}); 4125 } 4126 $item.css({ 'padding' : gutter/2 }); 4127 4128 if( $item.find('.eut-slider-element').length ) { 4129 $item.find('.eut-slider-element').trigger('refresh.owl.carousel'); 4130 } 4131 }); 4132 }, 4133 containerSize: function( $wrapper ){ 4134 var $container = $wrapper.find('.eut-isotope-container'), 4135 wrapperW = $wrapper.innerWidth(), 4136 gutter = !isNaN( $wrapper.data('gutter-size') ) ? Math.abs( $wrapper.data('gutter-size') ) : 0, 4137 columns = EUTHEM.isotope.getColumns( $wrapper ), 4138 offset = $wrapper.parents('.eut-section').hasClass('eut-fullwidth') ? - gutter : gutter, 4139 columnW = (wrapperW + offset) / columns; 4140 columnW = (columnW % 1 !== 0) ? Math.ceil(columnW) : columnW; 4141 var containerW = columnW * columns; 4142 4143 if ( $container.parents('.eut-section').hasClass('eut-fullwidth') ) { 4144 $container.css({ 'padding-left' : gutter/2, 'padding-right' : gutter/2, 'width' : containerW + gutter }); 4145 } else { 4146 $container.css({ 'margin' : - (gutter/2), 'width' : containerW }); 4147 } 4148 }, 4149 getColumns: function( $wrapper ){ 4150 var windowWidth = $(window).width(), 4151 columns = { 4152 largeS : $wrapper.data('columns-large-screen'), 4153 desktop : $wrapper.data('columns'), 4154 tabletL : $wrapper.data('columns-tablet-landscape'), 4155 tabletP : $wrapper.data('columns-tablet-portrait'), 4156 mobile : $wrapper.data('columns-mobile') 4157 }; 4158 4159 if ( windowWidth > largeScreen ) { 4160 columns = columns.largeS; 4161 } else if ( windowWidth > tabletLandscape && windowWidth <= largeScreen ) { 4162 columns = columns.desktop; 4163 } else if ( windowWidth > tabletPortrait && windowWidth <= tabletLandscape ) { 4164 columns = columns.tabletL; 4165 } else if ( windowWidth > mobileScreen && windowWidth <= tabletPortrait ) { 4166 columns = columns.tabletP; 4167 } else { 4168 columns = columns.mobile; 4169 } 4170 4171 return columns; 4172 }, 4173 itemsAnimation: function( items ){ 4174 $.each( items, function(index, item){ 4175 var delay = 200 * index; 4176 setTimeout(function () { 4177 $(item).find('.eut-isotope-item-inner').addClass('eut-animated'); 4178 }, delay); 4179 }); 4180 } 4181 }; 4182 4183 // # Scroll Direction 4184 // ============================================================================= // 4185 EUTHEM.scrollDir = { 4186 init: function(){ 4187 var scroll = $(window).scrollTop(); 4188 if (scroll > lastScrollTop){ 4189 lastScrollTop = scroll; 4190 return { direction : 'scrollDown' }; 4191 } else { 4192 lastScrollTop = scroll; 4193 return { direction : 'scrollUp' }; 4194 } 4195 4196 lastScrollTop = scroll; 4197 } 4198 }; 4199 4200 // # Full Page 4201 // ============================================================================= // 4202 EUTHEM.fullPage = { 4203 init: function(){ 4204 var $fPage = $('#eut-fullpage'); 4205 if( $fPage.length === 0 ) return; 4206 var $section = $fPage.find('.eut-row-section'); 4207 var deviceNavigation = true; 4208 var deviceAutoScrolling = true; 4209 var scrollOverflow = true; 4210 var fitToSection = true; 4211 var speed = $fPage.data('scroll-speed'); 4212 var deviceFullPageEnable = $fPage.data('device-scrolling') == 'yes' ? true : false;
4213 var lockAnchors = $fPage.data('lock-anchors') == 'yes' ? true : false; 4214 var loop = $fPage.data('scroll-loop'); 4215 var loopTop = false; 4216 var loopBottom = false; 4217 if ( 'both' == loop || 'top' == loop ) { 4218 loopTop = true; 4219 } 4220 if ( 'both' == loop || 'bottom' == loop ) { 4221 loopBottom = true; 4222 } 4223 4224 if( isMobile.any() && !deviceFullPageEnable ) { 4225 deviceNavigation = false; 4226 deviceAutoScrolling = false; 4227 scrollOverflow = false; 4228 fitToSection = false; 4229 $section.find('.eut-animated-item').addClass('eut-animated'); 4230 } 4231 4232 var navigationAnchorTooltips = $('[data-anchor-tooltip]').map(function(){ 4233 return $(this).data('anchor-tooltip').toString(); 4234 }).get(); 4235 4236 $fPage.fullpage({ 4237 navigation: deviceNavigation, 4238 navigationPosition: 'right', 4239 navigationTooltips: navigationAnchorTooltips, 4240 sectionSelector: $section, 4241 css3: true, 4242 scrollingSpeed: speed, 4243 autoScrolling : deviceAutoScrolling, 4244 fitToSection : fitToSection, 4245 lockAnchors : lockAnchors, 4246 loopTop : loopTop, 4247 loopBottom : loopBottom, 4248 scrollOverflow: scrollOverflow, 4249 afterLoad: function(anchorLink, index){ 4250 4251 var sectionHeaderColor = $($section[index-1]).attr('data-header-color'); 4252 var color = 'eut-' + sectionHeaderColor; 4253 4254 $section.find('.fp-tableCell').css('visibility','visible'); 4255 4256 // Set Header Color 4257 if( !$('#eut-main-header').hasClass('eut-header-side') ) { 4258 $('#eut-main-header').removeClass('eut-light eut-dark').addClass(color); 4259 } 4260 $('#fp-nav').removeClass('eut-light eut-dark').addClass(color); 4261 4262 EUTHEM.scrollingPageAnimations.addAnim( $section, index ); 4263 }, 4264 afterRender: function(){ 4265 var $videoBg = $('.eut-bg-video'); 4266 4267 $videoBg.each(function(){ 4268 var $that = $(this), 4269 $video = $that.find('video'); 4270 if( $video.length ){ 4271 $video[0].play(); 4272 } 4273 EUTHEM.pageSettings.resizeVideoBgElement( $that ); 4274 }); 4275 4276 }, 4277 onLeave: function(index){ 4278 if( !isMobile.any() ) { 4279 EUTHEM.scrollingPageAnimations.removeAnim( $section, index, speed ); 4280 } 4281 } 4282 }); 4283 } 4284 }; 4285 4286 // # Pilling Page 4287 // ============================================================================= // 4288 EUTHEM.pillingPage = { 4289 init: function(){ 4290 var $fPage = $('#eut-pilling-page'); 4291 if( $fPage.length === 0 ) return; 4292 var $section = $fPage.find('.eut-row-section'); 4293 var deviceFullPageEnable = $fPage.data('device-scrolling') == 'yes' ? true : false; 4294 var lockAnchors = $fPage.data('lock-anchors') == 'yes' ? true : false; 4295 var direction = $fPage.data('scroll-direction'); 4296 var loop = $fPage.data('scroll-loop'); 4297 var speed = $fPage.data('scroll-speed'); 4298 var loopTop = false; 4299 var loopBottom = false; 4300 if ( 'both' == loop || 'top' == loop ) { 4301 loopTop = true; 4302 } 4303 if ( 'both' == loop || 'bottom' == loop ) { 4304 loopBottom = true; 4305 } 4306 4307 if( isMobile.any() && !deviceFullPageEnable ) { 4308 $fPage.addClass('eut-disable-on-device'); 4309 $section.find('.eut-animated-item').addClass('eut-animated'); 4310 $section.children().wrap('<div class="pp-tableCell"></div>'); 4311 $('.eut-row-section').each(function(){ 4312 if ( $(this).attr('data-anchor').length ) { 4313 $(this).attr('id', $(this).attr('data-anchor') ); 4314 } 4315 }); 4316 return; 4317 } 4318 4319 var navigationAnchorTooltips = $('[data-anchor-tooltip]').map(function(){ 4320 return $(this).data('anchor-tooltip').toString(); 4321 }).get(); 4322 4323 4324 var navigationAnchors = []; 4325 if ( !lockAnchors ) { 4326 navigationAnchors = $('[data-anchor]').map(function(){ 4327 return $(this).data('anchor').toString(); 4328 }).get(); 4329 } 4330 4331 $('html').addClass('fp-enabled'); 4332 4333 $fPage.pagepiling({ 4334 sectionSelector: $section, 4335 css3: true, 4336 scrollingSpeed: speed, 4337 anchors: navigationAnchors, 4338 direction: direction, 4339 lockAnchors : lockAnchors, 4340 loopTop : loopTop, 4341 loopBottom : loopBottom, 4342 navigation: { 4343 'tooltips': navigationAnchorTooltips 4344 }, 4345 afterLoad: function(anchorLink, index){ 4346 4347 var sectionHeaderColor = $($section[index-1]).attr('data-header-color'); 4348 var color = 'eut-' + sectionHeaderColor; 4349 var $videoBg = $('.eut-bg-video'); 4350 4351 $videoBg.each(function(){ 4352 var $that = $(this), 4353 $video = $that.find('video'); 4354 if( $video.length ){ 4355 $video[0].play(); 4356 } 4357 EUTHEM.pageSettings.resizeVideoBgElement( $that ); 4358 }); 4359 // Set Header Color 4360 if( !$('#eut-main-header').hasClass('eut-header-side') ) { 4361 $('#eut-main-header').removeClass('eut-light eut-dark').addClass(color); 4362 } 4363 $('#pp-nav').removeClass('eut-light eut-dark').addClass(color); 4364 4365 EUTHEM.scrollingPageAnimations.addAnim( $section, index ); 4366 }, 4367 afterRender: function(){ 4368 var sectionHeaderColor = $($section[0]).attr('data-header-color'); 4369 var color = 'eut-' + sectionHeaderColor; 4370 var $videoBg = $('.eut-bg-video'); 4371 4372 $videoBg.each(function(){ 4373 var $that = $(this), 4374 $video = $that.find('video'); 4375 $video[0].play(); 4376 }); 4377 4378 // Set Header Color 4379 if( !$('#eut-main-header').hasClass('eut-header-side') ) { 4380 $('#eut-main-header').removeClass('eut-light eut-dark').addClass(color); 4381 } 4382 $('#pp-nav').removeClass('eut-light eut-dark').addClass(color); 4383 EUTHEM.scrollingPageAnimations.addAnim( $section, 1 ); 4384 }, 4385 onLeave: function(index){ 4386 EUTHEM.scrollingPageAnimations.removeAnim( $section, index, speed ); 4387 } 4388 }); 4389 } 4390 }; 4391 4392 // # Scrolling Page Animations 4393 // ============================================================================= // 4394 EUTHEM.scrollingPageAnimations = { 4395 addAnim: function( section, index ){ 4396 var $section = $(section[index-1]), 4397 $element = $section.find('.eut-animated-item'), 4398 $column = $section.find('.eut-clipping-animation'); 4399 4400 $element.each(function(){ 4401 var $that = $(this),
4402 delay = $that.data('delay'); 4403 if( $that.parents('.eut-clipping-animation').length ) return; 4404 setTimeout(function(){ 4405 $that.addClass('eut-animated'); 4406 },delay); 4407 }); 4408 4409 $column.each(function(){ 4410 var $that = $(this), 4411 $element = $that.find('.eut-animated-item'), 4412 delay = $that.data('delay'); 4413 setTimeout(function(){ 4414 EUTHEM.pageSettings.clippingAnimated( $that ); 4415 setTimeout(function(){ 4416 $element.addClass('eut-animated'); 4417 },700); 4418 },delay); 4419 }); 4420 }, 4421 4422 4423 removeAnim: function(section, index, speed){ 4424 var $section = $(section[index-1]), 4425 $element = $section.find('.eut-animated-item'); 4426 setTimeout(function(){ 4427 $element.removeClass('eut-animated'); 4428 },speed); 4429 } 4430 }; 4431 4432 // # Section Navigation 4433 // ============================================================================= // 4434 EUTHEM.sectionNav = { 4435 init: function(){ 4436 4437 var $content = $('#eut-content'); 4438 4439 // Check if content has class section-nav 4440 if( !$content.hasClass('eut-section-nav') ) return; 4441 4442 var $themeWrapper = $('#eut-theme-wrapper'); 4443 var $section = $('.eut-section[data-anchor]'); 4444 var anchor; 4445 4446 // Create Navigation List
4447 createList(); 4448 4449 var $navigation = $('#eut-section-nav'); 4450 var $navItem = $('#eut-section-nav .eut-nav-item'); 4451 var animate = false; 4452 4453 // On Click Navigation Item 4454 $navItem.on('click', function(event){ 4455 event.preventDefault(); 4456 var $that = $(this); 4457 var link = $that.attr('href'); 4458 var scrollTop = Math.abs($(window).scrollTop()) / 2; 4459 var speed = scrollTop < 1000 ? 1000 : scrollTop; 4460 var $target = $('.eut-section[data-anchor=' + link + ']'); 4461 var headerHeight = $('#eut-header').data('sticky') != 'none' && $('#eut-header').data('sticky') != 'scrollup' ? $('#eut-header').data('sticky-height') : 0; 4462 var targetTop = $target.offset().top - headerHeight + 1; 4463 4464 $that.addClass('active').siblings().removeClass('active'); 4465 4466 // Remove Scroll Up Classes 4467 if ( $.fn.StickyHeader && $('#eut-header').data('sticky') === 'scrollup' ) { 4468 $('#eut-header').data('eut_StickyHeader').destroyScrollUp(); 4469 } 4470 4471 smoothScroll( targetTop, speed ); 4472 4473 }); 4474 4475 updateNav(); 4476 $(window).on('scroll', function(){ 4477 if( !animate ){ 4478 updateNav(); 4479 } 4480 }); 4481 4482 function createList(){ 4483 $('<div id="eut-section-nav"><div class="eut-inner-nav"></div></div>').appendTo($themeWrapper); 4484 $section.each(function(){ 4485 var $that = $(this); 4486 var title = $that.data('anchor-tooltip'); 4487 anchor = $that.data('anchor'); 4488 var $listEl = $('<a class="eut-nav-item eut-small-text" href="' + anchor + '">' + title + '</a>'); 4489 if( title ) { 4490 $listEl.prependTo( $('#eut-section-nav .eut-inner-nav') ); 4491 } 4492 }); 4493 } 4494 4495 function updateNav(){ 4496 $section.each(function(){ 4497 var $that = $(this); 4498 if ( ( $that.offset().top - $(window).height()/2 < $(window).scrollTop() ) && ( $that.offset().top + $that.outerHeight() - $(window).height()/2 > $(window).scrollTop() ) ) { 4499 $navigation.find('a[href=' + $that.data('anchor') + ']').addClass('active'); 4500 } else { 4501 $navigation.find('a[href=' + $that.data('anchor') + ']').removeClass('active'); 4502 } 4503 }); 4504 } 4505 4506 function smoothScroll(target, speed){ 4507 if( !animate ) { 4508 animate = true; 4509 $('html, body').animate({scrollTop: target}, speed, 'easeInOutCubic',function(){ 4510 animate = false; 4511 }); 4512 $("html, body").on("scroll mousedown DOMMouseScroll mousewheel keyup", function(){ 4513 $('html, body').stop(); 4514 animate = false; 4515 }); 4516 } 4517 } 4518 } 4519 }; 4520 4521 // # Global Variables 4522 // ============================================================================= // 4523 var resizeTimeout; 4524 var bodyLoader = false;
4525 var largeScreen = 2048; 4526 var tabletLandscape = 1200; 4527 var tabletPortrait = 1023; 4528 var mobileScreen = 767; 4529 var lastScrollTop = 0; 4530 var wpBarHeight = $('.eut-body').hasClass('admin-bar') ? 32 : 0; 4531 var $videoBg = $('.eut-bg-video'); 4532 var isMobile = { 4533 Android: function() { 4534 return navigator.userAgent.match(/Android/i); 4535 }, 4536 BlackBerry: function() { 4537 return navigator.userAgent.match(/BlackBerry/i); 4538 }, 4539 iOS: function() { 4540 return navigator.userAgent.match(/iPhone|iPad|iPod/i); 4541 }, 4542 Opera: function() { 4543 return navigator.userAgent.match(/Opera Mini/i); 4544 }, 4545 Windows: function() { 4546 return navigator.userAgent.match(/IEMobile/i); 4547 }, 4548 any: function() { 4549 return (isMobile.Android() || isMobile.BlackBerry() || isMobile.iOS() || isMobile.Opera() || isMobile.Windows()); 4550 } 4551 }; 4552 4553 var deviceAnimAppear = false; 4554 if( 1 == crocal_eutf_main_data.device_animations ) { 4555 deviceAnimAppear = true; 4556 } 4557 4558 var spinner = '<div class="eut-spinner"><div></div><div></div><div></div><div></div></div>'; 4559 4560 var $document = $(document), 4561 $window = $(window), 4562 $body = $('body'), 4563 $stickyEl = $('.eut-sticky-element'); 4564 4565 // Animation support & prefixing 4566 var t = document.body || document.documentElement; 4567 var s = t.style; 4568 var tSupport = s.transition !== undefined || s.WebkitTransition !== undefined || s.MozTransition !== undefined || s.MsTransition !== undefined || s.OTransition !== undefined; 4569 var property = [ 'WebkitTransform', 'MozTransform', 'OTransform', 'msTransform' ]; 4570 var prefix; 4571 for( var i in property ){ 4572 if( s[ property[ i ] ] !== undefined ){ 4573 prefix = '-' + property[ i ].replace( 'Transform', '' ).toLowerCase(); 4574 } 4575 } 4576 var transform = prefix + '-transform'; 4577 4578 // # Scrollbar Width 4579 // ============================================================================= // 4580 var parent, child, scrollBarWidth; 4581 4582 if( scrollBarWidth === undefined ) { 4583 parent = $('<div style="width:50px;height:50px;overflow:auto"><div/></div>').appendTo('body'); 4584 child = parent.children(); 4585 scrollBarWidth = child.innerWidth()-child.height(99).innerWidth(); 4586 parent.remove(); 4587 } 4588 4589 $(function() { 4590 EUTHEM.documentReady.init(); 4591 }); 4592 4593 $(window).on('load',function () { 4594 EUTHEM.documentLoad.init(); 4595 }); 4596 4597 // Resize 4598 if( !isMobile.any() ) { 4599 $(window).on('resize', resizer); 4600 } else { 4601 $(window).on('orientationchange', resizer); 4602 } 4603 function resizer(){ 4604 window.clearTimeout(resizeTimeout); 4605 resizeTimeout = window.setTimeout(function () { 4606 EUTHEM.documentResize.init(); 4607 }, 300); 4608 } 4609 4610})(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.