1 2(function($) { 3 4 'use strict'; 5 6 ////////////////////////////////////////////////////////////////////////////////////////////////////// 7 // HEADER 8 ////////////////////////////////////////////////////////////////////////////////////////////////////// 9 var headerSettings = { 10 11 selector : '#grve-inner-header', 12 header : '#grve-header', 13 container : '#grve-inner-header .grve-container', 14 15 init: function(){ 16 if(!$(this.header).length) { 17 return; 18 } 19 // Add Helper wrapper for sticky header. 20 var $selector = $(this.selector); 21 $selector.wrap('<div id="grve-header-wrapper"></div>'); 22 $selector.css({ 'top' : 0 }); 23 headerSettings.stickyHeader(); 24 25 // Fixed Header integration with top bar 26 headerSettings.fixedHeader(); 27 $(window).smartresize( function() { 28 headerSettings.fixedHeader(); 29 }); 30 }, 31 stickyHeader: function(){ 32 var $selector = $(this.selector), 33 innerHeight = $selector.height(), 34 stickyStyle = $(this.header).attr('data-sticky-header'), 35 headerOffset = $(this.header).hasClass('grve-logo-top') ? $('.grve-bottom-header').offset().top : $selector.offset().top, 36 logoOnTop = $(this.header).hasClass('grve-logo-top') ? true : false, 37 safeButtonHeight = $selector.find('.grve-open-button').outerHeight(); 38 // General Setting 39 if( stickyStyle != 'none' && !logoOnTop ) { 40 if( headerOffset === 0 ) { 41 $selector.css({ 'position' : 'fixed', 'top' : 0 }); 42 } 43 $(window).on('scroll', function() { 44 headerSettings.stickySettings( headerOffset, stickyStyle ); 45 if( stickyStyle == 'shrink' ) { 46 headerSettings.shrinkSettings( innerHeight, headerOffset, safeButtonHeight ); 47 } 48 }); 49 } 50 if( logoOnTop && stickyStyle == 'simply' ){ 51 $(window).on('scroll', function() { 52 headerSettings.logoOnTopSticky( headerOffset ); 53 }); 54 } 55 }, 56 stickySettings: function( headerOffset, stickyStyle ){ 57 var scroll = $(window).scrollTop(), 58 $selector = $(this.selector), 59 $header = $(this.header), 60 $container = $(this.container), 61 windowWidth = $(window).width(); 62 63 if( scroll > headerOffset ){ 64 $header.addClass('grve-header-sticky'); 65 $selector.css({ 'position' : 'fixed', 'top' : wpBarHeight }); 66 } else { 67 $header.removeClass('grve-header-sticky'); 68 if( headerOffset > 0 ) { 69 $selector.css({ 'position' : 'absolute', 'top' : 0 }); 70 } 71 } 72 }, 73 shrinkSettings: function( innerHeight, headerOffset, safeButtonHeight ){ 74 var scroll = $(window).scrollTop(), 75 $selector = $(this.selector); 76 if( scroll > headerOffset + innerHeight *4 ) { 77 $selector.css({ 'height' : innerHeight/2, 'line-height' : innerHeight/2 + 'px' }); 78 $selector.find('h1.grve-logo img').css({ 'max-height' : innerHeight/2}); 79 if( safeButtonHeight > innerHeight/2 ) { 80 $selector.find('.grve-open-button').css({ 'height' : innerHeight/2, 'line-height' : innerHeight/2 + 'px' }); 81 } 82 } else { 83 $selector.css({ 'height' : innerHeight, 'line-height' : innerHeight + 'px' }); 84 $selector.find('h1.grve-logo img').css({ 'max-height' : innerHeight}); 85 if( safeButtonHeight > innerHeight/2 ) { 86 $selector.find('.grve-open-button').css({ 'height' : safeButtonHeight, 'line-height' : safeButtonHeight + 'px' }); 87 } 88 } 89 }, 90 logoOnTopSticky: function( headerOffset ){ 91 var scroll = $(window).scrollTop(), 92 $header = $(this.header), 93 $headerTop = $('.grve-top-header'), 94 $headerBottom = $('.grve-bottom-header'), 95 $selector = $(this.selector), 96 windowWidth = $(window).width(), 97 posTop = windowWidth + scrollBarWidth >= tabletPortrait ? - ( $headerTop.height() - wpBarHeight ) : 0.1; 98 99 if( scroll > headerOffset ){ 100 $header.addClass('grve-header-sticky'); 101 $selector.css({ 'position' : 'fixed', 'top' : posTop }); 102 } else { 103 $header.removeClass('grve-header-sticky'); 104 $selector.css({ 'position' : '', 'top' : '' }); 105 } 106 }, 107 fixedHeader: function(){ 108 var $header = $(this.header), 109 $topBar = $('#grve-top-bar'), 110 integration = $header.data('overlap'), 111 headerPosition = $header.data('header-position'); 112 113 if( $topBar.length && integration == 'yes' && headerPosition == 'above-feature' ){ 114 var topBarHeight = $topBar.outerHeight(), 115 $headerWrapper = $('#grve-header-wrapper'); 116 117 $headerWrapper.css('top',topBarHeight); 118 } 119 } 120 }; 121 ////////////////////////////////////////////////////////////////////////////////////////////////////// 122 // MAIN MENU 123 ////////////////////////////////////////////////////////////////////////////////////////////////////// 124 var mainMenu = { 125 126 menu : '#grve-main-menu', 127 menuItem : '#grve-main-menu li', 128 129 init: function() { 130 $(this.menuItem).mouseenter(function() { 131 var itemHover = $(this); 132 // Mega Menu Position 133 mainMenu.menuPosition(itemHover); 134 135 if( itemHover.hasClass('megamenu') ) {
136 itemHover.find( ' > ul ' ).addClass('active'); 137 } else { 138 itemHover.find( ' > ul > li > a' ).addClass('active'); 139 } 140 }); 141 $(this.menuItem).mouseleave(function() { 142 var itemHover = $(this); 143 if( itemHover.hasClass('megamenu') ) { 144 itemHover.find( ' > ul ' ).removeClass('active'); 145 } else { 146 itemHover.find( ' > ul > li > a' ).removeClass('active'); 147 } 148 }); 149 $(this.menuItem).find( ' > a[href="#"]').on('click',function(e){ 150 e.preventDefault(); 151 }); 152 mainMenu.responsiveMenu(); 153 154 // Respnsive Menu Style 2 155 mainMenu.responsiveMenuStyle2(); 156 157 // Fix Double Click on devices without responsive menu 158 if( isMobile.any() ) { 159 mainMenu.deviceMenu(); 160 } 161 162 }, 163 menuPosition: function(item){ 164 var containerWidth = $(this.menu).parent().outerWidth(), 165 subMenu = item.find(' > ul '), 166 subMenuWidth = subMenu.width(), 167 windowWidth = $(window).width(), 168 menuPositionX = item.offset().left; 169 if( (menuPositionX + subMenuWidth) > ( windowWidth - containerWidth )/2 + containerWidth ) { 170 if( item.hasClass('megamenu')) { 171 subMenu.css('left', - ((menuPositionX + subMenuWidth) - (( windowWidth - containerWidth )/2 + containerWidth )) +'px' ); 172 } else { 173 subMenu.addClass('grve-position-right'); 174 } 175 } 176 }, 177 deviceMenu: function(){ 178 var $menuItem = $(this.menuItem); 179 $menuItem.bind('touchstart touchend', function(e) { 180 var $item = $(this); 181 $item.siblings().removeClass('open-submenu'); 182 if( $item.hasClass('menu-item-has-children') && $item.find('> a').attr('href') != '#' ) { 183 if( !$item.hasClass('open-submenu') ) { 184 if( $item.hasClass('megamenu') ) { 185 $item.find( ' > ul ' ).addClass('active'); 186 } else { 187 $item.find( ' > ul > li > a' ).addClass('active'); 188 } 189 e.preventDefault(); 190 $item.addClass('open-submenu'); 191 } 192 } 193 }); 194 }, 195 responsiveMenu: function(){ 196 var menu = $('#grve-main-menu-responsive'), 197 btnOpenMenu = $('.grve-menu-button, .grve-responsive-menu-text'), 198 btnCloseMenu = $('.grve-close-menu-button'), 199 themeWrapper = $('#grve-theme-wrapper'), 200 menuLinks = menu.find('a[href*="#"]:not( [href="#"] )'); 201 202 btnOpenMenu.click(function(e){ 203 e.preventDefault(); 204 themeWrapper.toggleClass('grve-slide-left'); 205 menu.toggleClass('grve-slide-left'); 206 }); 207 btnCloseMenu.click(function(e){ 208 e.preventDefault(); 209 themeWrapper.removeClass('grve-slide-left'); 210 menu.removeClass('grve-slide-left'); 211 // Close All 212 mainMenu.closeAllChilds(); 213 }); 214 themeWrapper.click(function(e){ 215 if ( !menu.is(e.target) && menu.has(e.target).length === 0 && !btnOpe
215nMenu.is(e.target) && btnOpenMenu.has(e.target).length === 0 ) { 216 themeWrapper.removeClass('grve-slide-left'); 217 menu.removeClass('grve-slide-left'); 218 // Close All 219 mainMenu.closeAllChilds(); 220 } 221 }); 222 menuLinks.click(function(e) { 223 setTimeout(function(){ 224 themeWrapper.removeClass('grve-slide-left'); 225 menu.removeClass('grve-slide-left'); 226 // Close All 227 mainMenu.closeAllChilds(); 228 }, 1000); 229 }); 230 }, 231 responsiveMenuStyle2: function(){ 232 var $menu = $('#grve-main-menu-responsive'); 233 if( !$menu.hasClass('grve-style-2') ){ 234 return; 235 } 236 $menu.find('.menu-item-has-children').append('<div class="grve-more-btn"></div>') 237 238 $('.grve-more-btn').on('click',function(){ 239 $(this).toggleClass('close').parent().toggleClass('current-menu-item').children('.sub-menu').toggleClass('open'); 240 }); 241 242 $menu.find('a').on('click', function() { 243 if( ($(this).attr('href') == '#') || ($(this).attr('href') == '') ) { 244 $(this).parent().children('.grve-more-btn').trigger('click'); 245 } 246 }); 247 248 }, 249 closeAllChilds: function(){ 250 var $moreButton = $('.grve-more-btn'); 251 252 $moreButton.removeClass('close').parent().removeClass('current-menu-item').children('.sub-menu').removeClass('open'); 253 } 254 }; 255 ////////////////////////////////////////////////////////////////////////////////////////////////////// 256 // FEATURE SECTION SETTINGS 257 ////////////////////////////////////////////////////////////////////////////////////////////////////// 258 var featureSection = { 259 260 container : '#grve-feature-section .grve-feature-section-inner', 261 featureItem : $( '#grve-feature-section .grve-feature-section-inner' ).attr('data-item'), 262 fullScreenMode : $('#grve-header').attr('data-fullscreen'), 263 264 init: function(){ 265 if( this.featureItem == 'image' || this.featureItem == 'slider' || this.featureItem == 'video' ) { 266 featureSection.featureImageLoad(); 267 } 268 if( this.fullScreenMode == 'yes' ){ 269 featureSection.fullScreen(); 270 $(window).smartresize( function() { 271 featureSection.fullScreen(); 272 }); 273 } else { 274 featureSection.customSize(); 275 } 276 $("#grve-feature-goto.grve-custom-color").css("color",$("#grve-feature-goto.grve-custom-color").attr("data-custom-color")); 277 }, 278 fullScreen: function(){ 279 var windowHeight = $(window).height(), 280 headerHeight = $('#grve-header').attr('data-overlap') == 'yes' ? 0 : $('#grve-inner-header').height(), 281 topBarHeight = $('#grve-header').attr( 'data-topbar' ) == 'yes' ? $('#grve-top-bar').height() : 0, 282 $section = $(this.container); 283 if( isMobile.any() && window.location !== window.parent.location ) { 284 windowHeight = window.screen.height; 285 } 286 var sectionHeight = windowHeight - headerHeight - wpBarHeight - topBarHeight; 287 $section.css({ 'height' : sectionHeight }); 288 $section.parent().css({ 'height' : sectionHeight }); 289 if( this.featureItem == 'slider' ) { 290 $section.find('.grve-slider-item ').css({ 'height' : sectionHeight }); 291 } 292 if( this.featureItem == 'map' ) { 293 $section.find('.grve-map ').css({ 'height' : sectionHeight }); 294 } 295 if( this.featureItem == 'video' ) { 296 // Add Animation Class 297 $(featureSection.container).addClass('grve-animated'); 298 videoResize.init( { selector : $section.find('.grve-bg-video'), container : $section } ); 299 $(window).smartresize( function() { 300 videoResize.init( { selector : $section.find('.grve-bg-video'), container : $section } ); 301 }); 302 } 303 if(this.featureItem == 'title') { 304 // Add Animation Class 305 $(featureSection.container).addClass('grve-animated'); 306 } 307 }, 308 customSize: function(){ 309 var $section = $(this.container), 310 customHeight = $section.attr('data-height'); 311 featureSection.resizeFeature( $section, customHeight ); 312 $(window).smartresize( function() { 313 featureSection.resizeFeature( $section, customHeight ); 314 }); 315 if(this.featureItem == 'title') { 316 // Add Animation Class 317 $(featureSection.container).addClass('grve-animated'); 318 } 319 if(this.featureItem == 'video') { 320 // Add Animation Class 321 $(featureSection.container).addClass('grve-animated'); 322 } 323 }, 324 resizeFeature: function( section, customHeight ){ 325 if( $(window).width() >= 1200 ) { 326 section.css({ 'height' : customHeight }); 327 section.parent().css({ 'height' : customHeight }); 328 if( this.featureItem == 'slider' ) { 329 section.find('.grve-slider-item ').css({ 'height' : customHeight }); 330 } 331 if( this.featureItem == 'map' ) { 332 section.find('.grve-map ').css({ 'height' : customHeight }); 333 } 334 } else { 335 var ratio = customHeight / 1200, 336 resizeHeight = parseInt($(window).width() * ratio); 337 section.css({ 'height' : resizeHeight }); 338 section.parent().css({ 'height' : resizeHeight }); 339 if( this.featureItem == 'slider' ) { 340 section.find('.grve-slider-item ').css({ 'height' : resizeHeight }); 341 } 342 if( this.featureItem == 'map' ) { 343 section.find('.grve-map ').css({ 'height' : resizeHeight }); 344 } 345 } 346 }, 347 featureImageLoad: function(){ 348 var $bgImage = $(this.container).find('.grve-bg-image'), 349 totalBgImage = $bgImage.length; 350 if (!totalBgImage) { 351 return; 352 } 353 var waitImgDone = function() { 354 totalBgImage--; 355 if (!totalBgImage) { 356 if( $(featureSection.container).find( '.grve-slider').length ) { 357 featureSlider.init(); 358 } else { 359 $bgImage.addClass('show'); 360 // Add Animation Class 361 $(featureSection.container).addClass('grve-animated'); 362
363 // Zoom Image Effect 364 if( $(featureSection.container).data('bg-effect') == 'zoom') { 365 sectionSettings.animatedBg( $(featureSection.container) ); 366 } 367 } 368 } 369 }; 370 $bgImage.each(function () { 371 function imageUrl(input) { 372 return input.replace(/"/g,"").replace(/url\(|\)$/ig, ""); 373 } 374 var image = new Image(), 375 $that = $(this); 376 image.src = imageUrl($that.css('background-image')); 377 $(image).load(waitImgDone).error(waitImgDone); 378 }); 379 } 380 }; 381 ////////////////////////////////////////////////////////////////////////////////////////////////////// 382 // FEATURE SLIDER 383 ////////////////////////////////////////////////////////////////////////////////////////////////////// 384 var featureSlider = { 385 init: function(){ 386 var owl = $('#grve-feature-slider'), 387 sliderItem = owl.find('.grve-slider-item '), 388 sliderSpeed = ( parseInt( owl.attr('data-slider-speed') ) ) ? parseInt( owl.attr('data-slider-speed') ) : 3500, 389 pauseHover = owl.attr('data-slider-pause') == 'yes' ? true : '', 390 transition = owl.attr('data-slider-transition') != 'slide' ? owl.attr('data-slider-transition') : false; 391 // Init Slider 392 owl.owlCarousel({ 393 navigation : false, 394 pagination : false, 395 autoHeight : false, 396 slideSpeed : 400, 397 paginationSpeed : 400, 398 afterAction : featureSlider.afterAction, 399 singleItem : true, 400 autoPlay : true, 401 stopOnHover : pauseHover, 402 baseClass : 'grve-slider', 403 theme : 'grve-slider-style', 404 transitionStyle : transition 405 }); 406 owl.trigger('owl.play',sliderSpeed); 407 // Slider Navigation 408 owl.parent().find('.grve-carousel-next').click(function(){ 409 owl.trigger('owl.next'); 410 }); 411 owl.parent().find('.grve-carousel-prev').click(function(){ 412 owl.trigger('owl.prev'); 413 }); 414 sliderItem.find('.grve-bg-image').addClass('show'); 415 $(window).on('scroll', function() { 416 var $scroll = $(window).scrollTop(); 417 if( $scroll > 10 ){ 418 owl.trigger('owl.stop');//Stop Carousel 419 } else { 420 owl.trigger('owl.play',sliderSpeed);//Play Carousel 421 } 422 }); 423 424 if ( !Modernizr.csstransforms3d ) { 425 sliderItem.find('.grve-bg-image').css({ 'width' : $(window).width() }); 426 $(window).smartresize( function() { 427 sliderItem.find('.grve-bg-image').css({ 'width' : $(window).width() }); 428 }); 429 } 430 }, 431 afterAction: function(){ 432 var currentSlide = this.$owlItems.eq(this.currentItem), 433 sliderColor = currentSlide.find('.grve-slider-item').attr('data-style'), 434 color = 'grve-' + sliderColor, 435 sliderTitleColor = currentSlide.find('.grve-slider-item').attr('data-title-color'), 436 titleColor = 'grve-' + sliderTitleColor; 437 438 // Add Animation Class 439 if ( !Modernizr.csstransforms3d ) { 440 currentSlide.fadeIn('slow').addClass('grve-animated').siblings().hide().removeClass('grve-animated'); 441 } else { 442 currentSlide.addClass('grve-animated').siblings().removeClass('grve-animated'); 443 } 444 // Set Header Color 445 $('#grve-header').removeClass('grve-default grve-light grve-dark').addClass(color); 446 //Set GoTo Color 447 $('#grve-feature-goto').removeClass('grve-primary-1 grve-primary-2 grve-primary-3 grve-primary-4 grve-primary-5 grve-default grve-light grve-dark').addClass(titleColor); 448 449 } 450 }; 451 ////////////////////////////////////////////////////////////////////////////////////////////////////// 452 // VIDEO RESIZE 453 ////////////////////////////////////////////////////////////////////////////////////////////////////// 454 var videoResize = { 455 init: function(settings){ 456 457 videoResize.config = { 458 selector : '.grve-section .grve-bg-video', 459 container : '.grve-section' 460 }, 461 462 // allow overriding the default config 463 $.extend(videoResize.config, settings); 464 465 var $video = $(videoResize.config.selector).find('video'), 466 videoWidth = $video.width(), 467 videoHeight = $video.height(), 468 containerWidth = $(videoResize.config.container).outerWidth(), 469 containerHeight = $(videoResize.config.container).outerHeight(), 470 newSize = videoResize.settings( containerWidth, containerHeight, videoWidth, videoHeight ); 471 472 $video.width(newSize.newWidth).height(newSize.newHeight); 473 }, 474 settings: function( containerWidth, containerHeight, videoWidth, videoHeight ){ 475 var initW = videoWidth, 476 initH = videoHeight, 477 ratio = initH / initW; 478 videoWidth = containerWidth; 479 videoHeight = containerWidth * ratio; 480 if(videoHeight < containerHeight){ 481 videoHeight = containerHeight; 482 videoWidth = videoHeight / ratio; 483 } 484 return { 485 newWidth: parseInt(videoWidth), 486 newHeight: parseInt(videoHeight) 487 }; 488 } 489 }; 490 ////////////////////////////////////////////////////////////////////////////////////////////////////// 491 // SECTION SETTINGS 492 ////////////////////////////////////////////////////////////////////////////////////////////////////// 493 var sectionSettings = { 494 495 config : { 496 section : '#grve-main-content .grve-section', 497 parentSection : '#grve-content-area, #grve-post-area, #grve-portfolio-area' 498 }, 499 500 init: function(){ 501 502 $(sectionSettings.config.section).each(function(){ 503 var $section = $(this), 504 heightMode = $section.attr('data-full-height'), 505 sectionType = $section.attr('data-section-type'), 506 bgImageType = $section.attr('data-image-type'); 507 508 if( $section.parent().parent().is('.grve-blog-item') ) { 509 $section.css({ 'visibility': 'visible' }); 510 return; 511 } 512 if( sectionType == 'fullwidth-background' ){ 513 sectionSettings.fullBg($section); 514 $(window).smartresize( function() { 515 sectionSettings.fullBg($section); 516 }); 517 } 518 if( sectionType == 'fullwidth-element' ){ 519 sectionSettings.fullElement($section); 520 $(window).smartresize( function() { 521 sectionSettings.fullElement($section); 522 }); 523 } 524 if( heightMode == 'yes' ) { 525 sectionSettings.fullHeight($section); 526 $(window).smartresize( function() { 527 sectionSettings.fullHeight($section); 528 }); 529 } 530 if( bgImageType == 'animated' && !isMobile.any() ) { 531 sectionSettings.animatedBg($section); 532 } 533 534 }); 535 536 }, 537 fullBg: function(section){ 538 var windowWidth = $(window).width(), 539 contentWidth = $(sectionSettings.config.parentSection).outerWidth(), 540 sidebarWidth = $('#grve-sidebar').length && ( windowWidth + scrollBarWidth >= 1024 ) ? $('#grve-sidebar').outerWidth() : 0, 541 conteinerWidth = contentWidth + sidebarWidth, 542 space = (windowWidth - conteinerWidth)/2, 543 sidebarSpace = windowWidth - contentWidth; 544 if( $('.grve-right-sidebar').length && ( windowWidth + scrollBarWidth >= 1024 ) ) { 545 section.css({ 'visibility': 'visible', 'padding-left':space, 'padding-right': sidebarSpace, 'margin-left': -space, 'margin-right': -sidebarSpace}); 546 } 547 else if( $('.grve-left-sidebar').length && ( windowWidth + scrollBarWidth >= 1024 ) ) { 548 section.css({ 'visibility': 'visible', 'padding-left':sidebarSpace, 'padding-right': space, 'margin-left': -sidebarSpace, 'margin-right': -space}); 549 } else { 550 section.css({ 'visibility': 'visible', 'padding-left':space, 'padding-right': space, 'margin-left': -space, 'margin-right': -space}); 551 } 552 }, 553 fullElement: function(section){ 554 var windowWidth = $(window).width(), 555 contentWidth = $(sectionSettings.config.parentSection).outerWidth(), 556 sidebarWidth = $('#grve-sidebar').length && ( windowWidth + scrollBarWidth >= 1024 ) ? $('#grve-sidebar').outerWidth() : 0, 557 conteinerWidth = contentWidth + sidebarWidth, 558 space = (windowWidth - conteinerWidth)/2, 559 sidebarSpace = windowWidth - contentWidth; 560 if( $('.grve-right-sidebar').length && ( windowWidth + scrollBarWidth >= 1024 ) ) { 561 section.css({ 'visibility': 'visible', 'padding-left':0, 'padding-right': sidebarSpace, 'margin-left': -space, 'margin-right': -sidebarSpace}); 562 } 563 else if( $('.grve-left-sidebar').length && ( windowWidth + scrollBarWidth >= 1024 ) ) { 564 section.css({ 'visibility': 'visible', 'padding-left':sidebarSpace, 'padding-right': 0, 'margin-left': -sidebarSpace, 'margin-right': -space}); 565 } else { 566 section.css({ 'visibility': 'visible', 'padding-left':0, 'padding-right': 0, 'margin-left': -space, 'margin-right': -space}); 567 } 568 }, 569 fullHeight: function(section){ 570 var windowHeight = $(window).height(), 571 headerHeight = $('#grve-header').attr('data-sticky-header') != 'none' ? $('#grve-inner-header').outerHeight() : 0, 572 fieldBarHeight = $('.grve-fields-bar').length ? $('.grve-fields-bar').outerHeight() : 0, 573 sectionHeight = section.find('.grve-row').outerHeight(), 574 space = (windowHeight - headerHeight - fieldBarHeight - sectionHeight)/2; 575 section.css({ 'visibility': 'visible', 'padding-top' : 0, 'padding-bottom' : 0}); 576 if(sectionHeight > (windowHeight - headerHeight)){ 577 section.css({ 'visibility': 'visible', 'padding-top':40, 'padding-bottom': 40}); 578 } else { 579 section.css({ 'visibility': 'visible', 'padding-top':space, 'padding-bottom': space}); 580 } 581 }, 582 animatedBg: function(section){ 583 section.mouseenter(function() { 584 section.addClass('zoom'); 585 }); 586 section.mouseleave(function() { 587 section.removeClass('zoom'); 588 }); 589 } 590 }; 591 ////////////////////////////////////////////////////////////////////////////////////////////////////// 592 // CONTENT SETTINGS 593 ////////////////////////////////////////////////////////////////////////////////////////////////////// 594 var pageSettings = { 595 init: function() { 596 597 // HOVERS 598 pageSettings.hovers(); 599 600 // BACKGROUND LOAD 601 pageSettings.bgLoader(); 602 603 // LIGHT BOX 604 pageSettings.lightBox(); 605 606 // Social Share 607 pageSettings.socialShareLinks(); 608 609 // Animation Title 610 pageSettings.titleAnimation(); 611 612 // Fit Video 613 pageSettings.fitVid(); 614 615 // Resize Page, Post, Portfolio Title 616 pageSettings.resizeTitle(); 617 618 // Anchor Bar 619 pageSettings.anchorBar(); 620 621 // Back to top 622 pageSettings.backtoTop(); 623 624 // Goto Section 625 pageSettings.gotoFirstSection(); 626 627 // Sticky Sidebar 628 pageSettings.stickySidebar(); 629 630 // Footer Settings 631 pageSettings.footerSettings(); 632 633 // Grve Pop up 634 pageSettings.grvePopup(); 635 636 // Image Load 637 pageSettings.imageLoader(); 638 639 // Pie Chart 640 pageSettings.pieChart(); 641 642 }, 643 hovers: function(){ 644 var hoverItem = $('.grve-image-hover'); 645 if ( !isMobile.any() ) { 646 hoverItem.unbind('click'); 647 hoverItem.unbind('mouseenter mouseleave').bind('mouseenter mouseleave', function() { 648 $(this).toggleClass('hover'); 649 }); 650 } else { 651 hoverItem.unbind('mouseenter mouseleave'); 652 hoverItem.unbind('click').bind('click', function() { 653 hoverItem.removeClass('hover'); 654 $(this).toggleClass('hover'); 655 }); 656 } 657 }, 658 bgLoader: function() { 659 $('#grve-main-content .grve-bg-image, #grve-footer .grve-bg-image').each(function () { 660 function imageUrl(input) { 661 return input.replace(/"/g,"").replace(/url\(|\)$/ig, ""); 662 } 663 var image = new Image(), 664 $that = $(this); 665 image.src = imageUrl($that.css('background-image')); 666 image.onload = function () { 667 $that.addClass('show'); 668 }; 669 }); 670 }, 671 lightBox: function(){ 672 //IMAGE 673 $('.grve-image-popup').each(function() { 674 $(this).magnificPopup({ 675 type: 'image', 676 preloader: false, 677 fixedBgPos: true, 678 fixedContentPos: true, 679 removalDelay: 200, 680 callbacks: { 681 beforeOpen: function() { 682 var mfpWrap = this.wrap; 683 this.bgOverlay.fadeIn(200); 684 pageSettings.addSpinner( mfpWrap ); 685 }, 686 imageLoadComplete: function() { 687 var $spinner = this.wrap.find('.grve-loader'), 688 $content = this.container; 689 pageSettings.removeSpinner( $spinner, $content ); 690 691 }, 692 beforeClose: function() { 693 this.wrap.fadeOut(100); 694 this.bgOverlay.fadeOut(100); 695 }, 696 }, 697 image: { 698 verticalFit: true, 699 titleSrc: function(item) { 700 var title = item.el.data( 'title' ) ? item.el.data( 'title' ) : '', 701 caption = item.el.data('desc') ? '<br><small>' + item.el.data('desc') + '</small>' : ''; 702 if ( '' == title ) { 703 title = item.el.find('.grve-title').html() ? item.el.find('.grve-title').html() : ''; 704 } 705 if ( '' == caption ) { 706 caption = item.el.find('.grve-caption').html() ? '<br><small>' + item.el.find('.grve-caption').html() + '</small>' : ''; 707 } 708 return title + caption; 709 } 710 } 711 }); 712 }); 713 $('.grve-gallery-popup, .grve-post-gallery-popup').each(function() { 714 $(this).magnificPopup({ 715 delegate: 'a', 716 type: 'image', 717 preloader: false, 718 fixedBgPos: true, 719 fixedContentPos: true, 720 removalDelay: 200, 721 callbacks: { 722 beforeOpen: function() { 723 var mfpWrap = this.wrap; 724 this.bgOverlay.fadeIn(200); 725 pageSettings.addSpinner( mfpWrap ); 726 }, 727 imageLoadComplete: function() { 728 var $spinner = this.wrap.find('.grve-loader'), 729 $content = this.container; 730 pageSettings.removeSpinner( $spinner, $content ); 731 732 }, 733 beforeClose: function() { 734 this.wrap.fadeOut(100); 735 this.bgOverlay.fadeOut(100); 736 }, 737 }, 738 gallery: { 739 enabled:true 740 }, 741 image: { 742 tError: '<a href="%url%">The image #%curr%</a> could not be loaded.', 743 titleSrc: function(item) { 744 var title = item.el.data( 'title' ) ? item.el.data( 'title' ) : '', 745 caption = item.el.data('desc') ? '<br><small>' + item.el.data('desc') + '</small>' : ''; 746 if ( '' == title ) { 747 title = item.el.find('.grve-title').html() ? item.el.find('.grve-title').html() : ''; 748 } 749 if ( '' == caption ) { 750 caption = item.el.find('.grve-caption').html() ? '<br><small>' + item.el.find('.grve-caption').html() + '</small>' : ''; 751 } 752 return title + caption; 753 } 754 } 755 }); 756 }); 757 758 if( 1 == grve_main_data.grve_wp_gallery_popup ) { 759 $('.gallery').each(function() { 760 $(this).magnificPopup({ 761 delegate: 'a', 762 type: 'image', 763 preloader: false, 764 fixedBgPos: true, 765 fixedContentPos: true, 766 removalDelay: 200, 767 callbacks: { 768 beforeOpen: function() { 769 var mfpWrap = this.wrap; 770 this.bgOverlay.fadeIn(200); 771 pageSettings.addSpinner( mfpWrap ); 772 }, 773 imageLoadComplete: function() { 774 var $spinner = this.wrap.find('.grve-loader'), 775 $content = this.container; 776 pageSettings.removeSpinner( $spinner, $content ); 777 778 }, 779 beforeClose: function() { 780 this.wrap.fadeOut(100); 781 this.bgOverlay.fadeOut(100); 782 }, 783 }, 784 gallery: { 785 enabled:true 786 }, 787 image: { 788 tError: '<a href="%url%">The image #%curr%</a> could not be loaded.', 789 titleSrc: function(item) { 790 var title = item.el.closest('.gallery-item').find('.gallery-caption').html() ? item.el.closest('.gallery-item').find('.gallery-caption').html() : ''; 791 return title; 792 } 793 } 794 }); 795 }); 796 } 797 //VIDEOS 798 $('.grve-youtube-popup, .grve-vimeo-popup, .grve-video-popup, .grve-page-popup').each(function() { 799 $(this).magnificPopup({ 800 disableOn: 0, 801 type: 'iframe', 802 preloader: false, 803 fixedBgPos: true, 804 fixedContentPos: true, 805 removalDelay: 200, 806 callbacks: { 807 beforeOpen: function() { 808 var mfpWrap = this.wrap; 809 this.bgOverlay.fadeIn(200); 810 pageSettings.addSpinner( mfpWrap ); 811 }, 812 open: function() { 813 var $spinner = this.wrap.find('.grve-loader'), 814 $content = this.container; 815 pageSettings.removeSpinner( $spinner, $content ); 816 }, 817 beforeClose: function() { 818 this.wrap.fadeOut(100); 819 this.bgOverlay.fadeOut(100); 820 }, 821 } 822 }); 823 }); 824 }, 825 addSpinner: function( mfpWrap ){ 826 var spinner = '<div class="grve-loader"></div>'; 827 $(spinner).appendTo( mfpWrap ); 828 }, 829 removeSpinner: function( spinner, content){ 830 setTimeout(function(){ 831 spinner.fadeOut(1000, function(){ 832 content.animate({'opacity':1},600); 833 }); 834 }, 700); 835 }, 836 socialShareLinks: function(){ 837 $('.grve-social-share-facebook').click(function (e) { 838 e.preventDefault(); 839 window.open( 'https://www.fac
839ebook.com/sharer/sharer.php?u=' + $(this).attr('href'), "facebookWindow", "height=380,width=660,resizable=0,toolbar=0,menubar=0,status=0,location=0,scrollbars=0" ); 840 return false; 841 }); 842 $('.grve-social-share-twitter').click(function (e) { 843 e.preventDefault(); 844 window.open( 'http://twitter.com/intent/tweet?text=' + $(this).attr('title') + ' ' + $(this).attr('href'), "twitterWindow", "height=450,width=660,resizable=0,toolbar=0,menubar=0,status=0,location=0,scrollbars=0" ); 845 return false; 846 }); 847 $('.grve-social-share-linkedin').click(function (e) { 848 e.preventDefault(); 849 window.open( 'http://www.linkedin.com/shareArticle?mini=true&url=' + $(this).attr('href') + '&title=' + $(this).attr('title'), "linkedinWindow", "height=500,width=820,resizable=0,toolbar=0,menubar=0,status=0,location=0,scrollbars=0" ); 850 return false; 851 }); 852 $('.grve-social-share-googleplus').click(function (e) { 853 e.preventDefault(); 854 window.open( 'https://plus.google.com/share?url=' + $(this).attr('href'), "googleplusWindow", "height=600,width=600,resizable=0,toolbar=0,menubar=0,status=0,location=0,scrollbars=0" ); 855 return false; 856 }); 857 $('.grve-social-share-pinterest').click(function (e) { 858 e.preventDefault(); 859 window.open( 'http://pinterest.com/pin/create/button/?url=' + $(this).attr('href') + '&media=' + $(this).data('pin-img') + '&description=' + $(this).attr('title'), "pinterestWindow", "height=600,width=600,resizable=0,toolbar=0,menubar=0,status=0,location=0,scrollbars=0" ); 860 return false; 861 }); 862 $('.grve-social-share-reddit').click(function (e) { 863 e.preventDefault(); 864 window.open( '//www.reddit.com/submit?url=' + $(this).attr('href'), "redditWindow", "height=600,width=820,resizable=0,toolbar=0,menubar=0,status=0,location=0,scrollbars=0" ); 865 return false; 866 }); 867 $('.grve-like-counter-link').click(function (e) { 868 e.preventDefault(); 869 var link = $(this); 870 var id = link.data('post-id'), 871 counter = link.parent().find('.grve-like-counter'); 872 873 var ajaxurl = grve_main_data.ajaxurl; 874 875 $.ajax({type: 'POST', url: ajaxurl, data: 'action=grve_likes_callback&grve_likes_id=' + id, success: function(result) { 876 counter.html(result); 877 }}); 878 return false; 879 }); 880 }, 881 postSocials: function(){ 882 var $selector = $('#grve-post-title #grve-social-share'); 883 if(!$selector.length || isMobile.any()) { 884 return; 885 } 886 stickyItems.init({ element : $selector, offset : 10 }); 887 $(window).scroll(function(){ 888 var socialTop = $selector.offset().top, 889 fieldsBarTop = $('.grve-fields-bar').offset().top; 890 if( socialTop == fieldsBarTop + 10 ) { 891 $selector.addClass('in-bar'); 892 } else { 893 $selector.removeClass('in-bar'); 894 } 895 }); 896 }, 897 titleAnimation: function(){ 898 var titleContainer = $('#grve-page-title, #grve-post-title, #grve-portfolio-title, #grve-product-title'); 899 titleContainer.find('.grve-container').addClass('grve-animated'); 900 }, 901 fitVid: function(){ 902 $('.grve-video, .grve-media').fitVids(); 903 }, 904 // No Parallax video 905 sectionBgVideo: function(){ 906 var section = '.grve-bg-video.grve-bg-no-parallax'; 907 videoResize.init( { selector : section, container : section } ); 908 $(window).smartresize( function() { 909 videoResize.init( { selector : section, container : section } ); 910 }); 911 }, 912 resizeTitle: function(){ 913 var titleContainer = $(' #grve-page-title-content'); 914 if( $('#grve-post-title').length ) { 915 titleContainer = $(' #grve-post-title-content'); 916 } 917 if( $('#grve-portfolio-title').length ) { 918 titleContainer = $(' #grve-portfolio-title-content'); 919 } 920 if( $('#grve-product-title').length ) { 921 titleContainer = $(' #grve-product-title-content'); 922 } 923 if( titleContainer.length ) { 924 featureSection.resizeFeature( titleContainer, titleContainer.attr('data-height') ); 925 $(window).smartresize( function() { 926 featureSection.resizeFeature( titleContainer, titleContainer.attr('data-height') ); 927 }); 928 } 929 }, 930 anchorBar: function(){ 931 var $selector = $('#grve-anchor-menu'), 932 $section = $('#grve-main-content .grve-section[id]'), 933 headerHeight = 0, 934 fieldBarHeight = $('.grve-fields-bar').length ? $('.grve-fields-bar').outerHeight() : 0, 935 $menu = $selector.find('ul'),
936 $menuIcon = $selector.find('.grve-icon-menu'); 937 938 if( $('#grve-header').data('sticky-header') != 'none' ){ 939 if( $('#grve-header').hasClass('grve-logo-top') ) { 940 headerHeight = $('.grve-bottom-header').outerHeight(); 941 } else { 942 headerHeight = $('#grve-inner-header').outerHeight(); 943 } 944 } 945 946 var offsetTop = headerHeight + fieldBarHeight + wpBarHeight; 947 948 if(!$selector.length) { 949 return; 950 } 951 pageSettings.anchorBarUpdate( $selector, $menu ); 952 $(window).smartresize( function() { 953 pageSettings.anchorBarUpdate( $selector, $menu ); 954 }); 955 $menuIcon.click(function(){ 956 $menu.slideToggle(100); 957 }); 958 959 $(window).on("scroll", function() { 960 if(!$selector.hasClass('grve-current-link')) { 961 return; 962 } 963 964 var scroll = $(window).scrollTop(); 965 966 $section.each(function(){ 967 var $that = $(this), 968 currentId = $that.attr('id'), 969 sectionOffset = $that.offset().top - offsetTop -1; 970 971 if (sectionOffset <= scroll && sectionOffset + $that.outerHeight() > scroll ) { 972 $('#grve-anchor-menu a[href*="#' + currentId + '"]').parent().addClass('current'); 973 } 974 else{ 975 $('#grve-anchor-menu a[href*="#' + currentId + '"]').parent().removeClass("current"); 976 } 977 978 }); 979 }); 980 }, 981 anchorBarUpdate: function( selector, menu ){ 982 var $selector = selector, 983 $menu = menu, 984 menuWidth = $menu.outerWidth(), 985 windowWidth = $(window).width(); 986 if( menuWidth >= windowWidth ) { 987 $selector.addClass('grve-responsive-bar'); 988 $menu.css('display', 'none'); 989 } 990 }, 991 backtoTop: function() { 992 var selectors = { 993 topBtn : '.grve-top-btn', 994 dividerBtn : '.grve-divider-backtotop', 995 topLink : 'a[href="#grve-goto-header"]' 996 } 997 // Show backtoTop Button 998 if( $('#grve-header').attr('data-backtotop') != 'no' ) { 999 var btnUp = $('<div/>', {'class':'grve-top-btn grve-icon-nav-up'}); 1000 btnUp.appendTo('#grve-theme-wrapper'); 1001 1002 $(window).on('scroll', function() { 1003 if ($(this).scrollTop() > 600) { 1004 $('.grve-top-btn').addClass('show'); 1005 } else { 1006 $('.grve-top-btn').removeClass('show'); 1007 } 1008 }); 1009 } 1010 $.each(selectors, function(key, value){ 1011 $(value).on('click', function(){ 1012 $('html, body').animate({scrollTop: 0}, 900); 1013 }); 1014 }); 1015 1016 }, 1017 gotoFirstSection: function(){ 1018 var $selector = $('#grve-feature-section .grve-goto-section'), 1019 $nextSection = $('#grve-main-content .grve-section').first().length ? $('#grve-main-content .grve-section').first() : $('#grve-main-content'), 1020 topOffset = 0, 1021 fieldBarHeight = $('.grve-fields-bar').length ? $('.grve-fields-bar').outerHeight() : 0; 1022 1023 if( !isMobile.any() && $('#grve-header').data('sticky-header') != 'none' ){ 1024 if( $('#grve-header').hasClass('grve-logo-top') ) { 1025 topOffset = $('.grve-bottom-header').outerHeight(); 1026 } else { 1027 topOffset = $('#grve-inner-header').outerHeight(); 1028 } 1029 } 1030 1031 if( $nextSection.length ) { 1032 $selector.on('click',function(){ 1033 $('html,body').animate({ 1034 scrollTop: $nextSection.offset().top - topOffset - fieldBarHeight 1035 }, 1000); 1036 return false; 1037 }); 1038 } 1039 }, 1040 stickySidebar: function(){ 1041 var $item = $('#grve-sidebar.grve-fixed-sidebar'), 1042 $content = $('#grve-content-area, #grve-post-area, #grve-portfolio-area'); 1043 if( !$item.length ) { 1044 return; 1045 } 1046 var itemId = $item.attr('id'), 1047 itemHeight = $item.outerHeight(), 1048 itemWidth = $item.outerWidth() - 1, 1049 itemFloat = $item.css('float'), 1050 headerHeight = $('#grve-inner-header').outerHeight(), 1051 titleHeight = $('#grve-page-title').length ? $('#grve-page-title').outerHeight() : 0, 1052 fieldBarHeight = $('.grve-fields-bar').length ? $('.grve-fields-bar').outerHeight() : 0, 1053 topBarHeight = $('#grve-top-bar').length ? $('#grve-top-bar').outerHeight() : 0, 1054 offset = headerHeight + fieldBarHeight + 30, 1055 windowHeight = $(window).height(); 1056 if( itemHeight > windowHeight || isMobile.any() ) { 1057 return false; 1058 } 1059 // Create A Helper Wrapper 1060 $item.wrap('<div id="' + itemId + '-wrapper"></div>' ); 1061 $item.parent().css({ 1062 'width' : itemWidth, 1063 'height' : itemHeight, 1064 'float' : itemFloat, 1065 'position' : 'relative' 1066 }); 1067 $item.css({ 1068 'width' : itemWidth, 1069 'position' : 'static' 1070 }); 1071 $(window).on('scroll', function() { 1072 var contentHeight = $content.outerHeight(), 1073 contentTop = $content.offset().top, 1074 contentBottom = contentTop + contentHeight; 1075 if( ( $(window).scrollTop() > contentTop - offset ) && ( $(window).scrollTop() < contentBottom - ( offset + itemHeight ) )){ 1076 $item.css({'position':'fixed', 'width' : itemWidth, 'top': offset }); 1077 } 1078 else if( $(window).scrollTop() > contentTop ){ 1079 $item.css({'position':'absolute', 'top': contentHeight - itemHeight }); 1080 } 1081 else if( $(window).scrollTop() < contentTop ){ 1082 $item.css({'position':'static', 'top':'auto' }); 1083 } 1084 }); 1085 }, 1086 footerSettings: function() { 1087 $('#grve-footer .grve-section').each(function(){ 1088 var $that = $(this), 1089 sectionType = $that.attr('data-section-type'); 1090 if( sectionType == 'fullwidth-background' ){ 1091 pageSettings.footerFullBg($that); 1092 $(window).smartresize( function() { 1093 pageSettings.footerFullBg($that); 1094 }); 1095 } 1096 if( sectionType == 'fullwidth-element' ){ 1097 pageSettings.footerFullElement($that); 1098 $(window).smartresize( function() { 1099 pageSettings.footerFullElement($that); 1100 }); 1101 } 1102 }); 1103 }, 1104 footerFullBg: function(element){ 1105 var windowWidth = $(window).width(), 1106 contentWidth = element.parent().width(), 1107 space = (windowWidth - contentWidth)/2; 1108 element.css({ 'visibility': 'visible', 'padding-left':space, 'padding-right': space, 'margin-left': -space, 'margin-right': -space}); 1109 }, 1110 footerFullElement: function(element){ 1111 var windowWidth = $(window).width(), 1112 contentWidth = element.parent().width(), 1113 space = (windowWidth - contentWidth)/2; 1114 element.css({ 'visibility': 'visible', 'padding-left':0, 'padding-right': 0, 'margin-left': -space, 'margin-right': -space}); 1115 }, 1116 grvePopup: function(){ 1117 var $selector = $('.grve-open-popup-link'),
1118 delay = 0; 1119 1120 $selector.on( "click", function(e){ 1121 e.preventDefault(); 1122 var target = $(this).attr('href'); 1123 if( !$(target).length ){ 1124 return; 1125 } else { 1126 if( $(this).parents('#grve-main-menu-responsive').length ) { 1127 delay = 2000; 1128 } 1129 setTimeout(function(){ 1130 $(target).addClass('grve-show-modal'); 1131 },delay); 1132 1133 $('.grve-popup-overlay, .grve-close-modal').on( "click", function(e){ 1134 if ( !$(target).is(e.target) ) { 1135 $(target).removeClass('grve-show-modal'); 1136 } 1137 }); 1138 } 1139 }); 1140 }, 1141 imageLoader: function(){ 1142 var selectors = { 1143 singleImage : '.grve-image', 1144 media : '.grve-media' 1145 } 1146 $.each(selectors, function(key, value){ 1147 if( $(this).length ){ 1148 var item = $(this), 1149 imgLoad = imagesLoaded( item ); 1150 imgLoad.on( 'always', function() { 1151 if( $(value).parent().is('#grve-single-media') ){ 1152 $(value).find('img').animate({ 'opacity': 1 },1000); 1153 } else { 1154 $(value).find('img').css('opacity', 1); 1155 } 1156 }); 1157 } 1158 }); 1159 }, 1160 removeVideoBg: function(){ 1161 var videoBg = $('.grve-bg-video'); 1162 if( isMobile.any() ) { 1163 videoBg.remove(); 1164 } else { 1165 $('#grve-main-content .grve-bg-image, #grve-feature-section .grve-bg-image').each(function () { 1166 var bgImage = $(this); 1167 var bgVideo = $(this).parent().find('.grve-bg-video'); 1168 if ( bgVideo.length ) { 1169 var videoElement = $(this).parent().find('.grve-bg-video video'); 1170 var canPlayVideo = false; 1171 $(this).parent().find('.grve-bg-video source').each(function(){ 1172 if ( videoElement.get(0).canPlayType( $(this).attr('type') ) ) { 1173 canPlayVideo = true; 1174 } 1175 }); 1176 if(canPlayVideo) { 1177 bgImage.remove(); 1178 } else { 1179 bgVideo.remove(); 1180 } 1181 } 1182 }); 1183 } 1184 }, 1185 gotoSection: function(){ 1186 if( $('#grve-header').data('gotosection') == 'yes' ) { 1187 var $section = $('#grve-main-content .grve-section[id]'), 1188 $anchorList = $('<ul id="grve-anchor-list"></ul>'), 1189 $mainContent = $('#grve-main-content'); 1190 1191 $anchorList.appendTo( $mainContent ); 1192 1193 $section.each(function( i , n){ 1194 var $that = $(this), 1195 sectionId = $that.attr('id'), 1196 sectionTitle = $that.data('section-title').length ? '<span>' + $that.data('section-title') + '</span>' : '', 1197 $anchorItem = $('<li data-anclink="' + sectionId + '">' + sectionTitle + '</li>') 1198 1199 $anchorItem.appendTo('#grve-anchor-list'); 1200 }); 1201 // Show or Hide Go to Section 1202 pageSettings.showHideGoTo(); 1203 1204 var $listItem = $('#grve-anchor-list li'); 1205 $listItem.click(function(){ 1206 var headerHeight = 0, 1207 fieldBarHeight = $('.grve-fields-bar').length ? $('.grve-fields-bar').outerHeight() : 0; 1208 1209 if( $('#grve-header').data('sticky-header') != 'none' ){ 1210 if( $('#grve-header').hasClass('grve-logo-top') ) { 1211 headerHeight = $('.grve-bottom-header').outerHeight(); 1212 } else { 1213 headerHeight = $('#grve-inner-header').outerHeight(); 1214 } 1215 } 1216 var offsetTop = headerHeight + fieldBarHeight + wpBarHeight; 1217 1218 var target = $(this).data('anclink'); 1219 $('html, body').animate({scrollTop: $('#'+ target).offset().top - ( offsetTop - 1 )}, 600); 1220 }); 1221 } 1222 }, 1223 showHideGoTo: function(){ 1224 var contentOffSet = $('#grve-main-content').offset().top, 1225 $section = $('#grve-main-content .grve-section'), 1226 $anchorList = $('#grve-anchor-list'), 1227 $anchorItem = $('#grve-anchor-list li'), 1228 headerHeight = 0, 1229 fieldBarHeight = $('.grve-fields-bar').length ? $('.grve-fields-bar').outerHeight() : 0; 1230 1231 if( $('#grve-header').data('sticky-header') != 'none' ){ 1232 if( $('#grve-header').hasClass('grve-logo-top') ) { 1233 headerHeight = $('.grve-bottom-header').outerHeight(); 1234 } else { 1235 headerHeight = $('#grve-inner-header').outerHeight(); 1236 } 1237 } 1238 var offsetTop = headerHeight + fieldBarHeight + wpBarHeight; 1239 1240 1241 $(window).on("scroll", function() { 1242 var scroll = $(window).scrollTop(), 1243 sectionOffset = $section.offset().top, 1244 anchorOffset = $anchorList.offset().top, 1245 anchorHeight = $anchorList.height(); 1246 1247 if( scroll > contentOffSet - offsetTop ){ 1248 $anchorList.addClass( 'show '); 1249 } else { 1250 $anchorList.removeClass( 'show' ); 1251 } 1252 1253 $anchorItem.each(function(){ 1254 var currLink = $(this).data('anclink'), 1255 refElement = $('#' + currLink), 1256 refElementMargin = parseInt(refElement.css('margin-bottom')), 1257 refElementOffset = refElement.offset().top - offsetTop; 1258 1259 if (refElementOffset <= anchorOffset - anchorHeight/2 && refElementOffset + refElement.outerHeight() + refElementMargin > anchorOffset - anchorHeight/2) { 1260 $(this).addClass("active"); 1261 } 1262 else{ 1263 $(this).removeClass("active"); 1264 } 1265 1266 }); 1267 }); 1268 1269 }, 1270 refMainMenu: function(){ 1271 1272 var $section = $('#grve-main-content .grve-section[id]'), 1273 headerHeight = 0, 1274 fieldBarHeight = $('.grve-fields-bar').length ? $('.grve-fields-bar').outerHeight() : 0; 1275 1276 1277 if( $('#grve-header').data('sticky-header') != 'none' ){ 1278 if( $('#grve-header').hasClass('grve-logo-top') ) { 1279 headerHeight = $('.grve-bottom-header').outerHeight(); 1280 } else { 1281 headerHeight = $('#grve-inner-header').outerHeight(); 1282 } 1283 } 1284 1285 var offsetTop = headerHeight + fieldBarHeight + wpBarHeight; 1286 1287 $(window).on("scroll", function() { 1288 var scroll = $(window).scrollTop(); 1289 1290 $section.each(function(){ 1291 var $that = $(this), 1292 currentId = $that.attr('id'), 1293 sectionOffset = $that.offset().top - offsetTop; 1294 1295 if (sectionOffset <= scroll && sectionOffset + $that.outerHeight() > scroll ) { 1296 $('#grve-main-menu a[href*="#' + currentId + '"]').parent().addClass('active'); 1297 } 1298 else{ 1299 $('#grve-main-menu a[href*="#' + currentId + '"]').parent().removeClass("active"); 1300 } 1301 1302 }); 1303 }); 1304 }, 1305 pieChart: function(){ 1306 1307 $('.grve-chart-number').each(function() { 1308 var $element = $(this), 1309 delay = $element.parent().attr('data-delay') !== '' ? parseInt( $element.parent().attr('data-delay') ) : 0, 1310 chartSize = '170'; 1311 1312 $element.css({ 'width' : chartSize, 'height' : chartSize, 'line-height' : chartSize + 'px' }); 1313 1314 $element.appear(function() { 1315 setTimeout(function () { 1316 pageSettings.pieChartInit( $element ); 1317 }, delay); 1318 }); 1319 }); 1320 1321 }, 1322 pieChartInit: function( $element ){ 1323 1324 var activeColor = $element.data('pie-active-color') !== '' ? $element.data('pie-active-color') : 'rgba(0,0,0,1)', 1325 pieColor = $element.data('pie-color') !== '' ? $element.data('pie-color') : 'rgba(0,0,0,0.1)', 1326 pieLineCap = $element.data('pie-line-cap') !== '' ? $element.data('pie-line-cap') : 'round', 1327 lineSize = $element.data('pie-line-size') !== '' ? $element.data('pie-line-size') : '6', 1328 chartSize = '170'; 1329 1330 1331 $element.easyPieChart({ 1332 barColor: activeColor, 1333 trackColor: pieColor, 1334 scaleColor: false, 1335 lineCap: pieLineCap, 1336 lineWidth: lineSize, 1337 animate: 1500, 1338 size: chartSize 1339 }); 1340 }, 1341 fixedFooter: function(){ 1342 var $footer = $('#grve-footer'), 1343 sticky = $footer.data('sticky-footer'); 1344 if( sticky != 'yes' || isMobile.any() ) { 1345 return; 1346 } else { 1347 pageSettings.footerHeight(); 1348 $(window).smartresize( function() { 1349 pageSettings.footerHeight(); 1350 }); 1351 } 1352 }, 1353 footerHeight: function(){ 1354 var $footer = $('#grve-footer'), 1355 windowHeight = $(window).height(), 1356 footerHeight = $footer.outerHeight(); 1357 1358 if( footerHeight > windowHeight ) { 1359 $('#grve-footer').removeClass('grve-sticky-footer').prev().css('margin-bottom',0); 1360 } else { 1361 $('#grve-footer').addClass('grve-sticky-footer').prev().css('margin-bottom',footerHeight); 1362 } 1363 1364 } 1365 }; 1366 1367 // ------------------------------------------------------------------------------------------- 1368 // SIDE MENU OPEN 1369 // ------------------------------------------------------------------------------------------- 1370 var menuOpen = false;
1371 1372 var headerOptions = { 1373 1374 menuIcon : $('#grve-header-options > li'), 1375 menuWrapper : $('.grve-options-wrapper'), 1376 1377 init: function(){ 1378 this.menuIcon.on('click',function(e){ 1379 e.preventDefault(); 1380 if(menuOpen) { 1381 headerOptions.closeMenu(); 1382 } else { 1383 headerOptions.openMenu(); 1384 } 1385 }); 1386 1387 if( isMobile.any() ) { 1388 return; 1389 } else { 1390 this.menuIcon.on( 'mouseover', function() { headerOptions.openIconMenu(); } ); 1391 this.menuWrapper.on( 'mouseover', function() { headerOptions.openMenu(); } ); 1392 this.menuIcon.on( 'mouseout', function() { headerOptions.closeMenu(); }); 1393 } 1394 }, 1395 openIconMenu: function(){ 1396 this.menuWrapper.addClass('grve-open-part'); 1397 this.menuIcon.addClass('grve-open'); 1398 }, 1399 openMenu: function(){ 1400 this.menuWrapper.addClass('grve-open-all'); 1401 this.menuIcon.addClass('grve-open'); 1402 menuOpen = true; 1403 }, 1404 closeMenu: function(){ 1405 this.menuWrapper.removeClass('grve-open-part grve-open-all'); 1406 this.menuIcon.removeClass('grve-open'); 1407 menuOpen = false; 1408 } 1409 }; 1410 1411 ////////////////////////////////////////////////////////////////////////////////////////////////////// 1412 // SET EQUAL COLUMNS HEIGHT 1413 ////////////////////////////////////////////////////////////////////////////////////////////////////// 1414 var setColumnHeight = { 1415 init: function(){ 1416 var section = '.grve-section', 1417 windowWidth = $(window).width() + scrollBarWidth; 1418 1419 $(section).each(function(){ 1420 var $that = $(this), 1421 $column = $that.find('.grve-row').first().children(); 1422 1423 if( $that.hasClass('grve-flex-row') ) { 1424 equalHeight( $that, $column ); 1425 } 1426 if( $that.hasClass('grve-middle-content') ) { 1427 middleContent( $that, $column ); 1428 } 1429 }); 1430 1431 function equalHeight( section, $column ) { 1432 section.imagesLoaded('always',function(){ 1433 $column.css({ 'min-height': '', 'padding-top': '', 'padding-bottom': '' }); 1434 var maxHeight = setColumnHeight.getMaxHeight( section ); 1435 if( ( windowWidth <= tabletLandscape && $column.hasClass('grve-tablet-column-1') ) || windowWidth <= tabletPortrait ) { 1436 $column.css({ 'min-height': '', 'visibility': 'visible' }); 1437 } else { 1438 $column.css({ 'min-height': maxHeight, 'visibility': 'visible' }); 1439 } 1440 }); 1441 } 1442 1443 function middleContent( section, $column ) { 1444 section.imagesLoaded('always',function(){ 1445 $column.css({ 'min-height': '', 'padding-top': '', 'padding-bottom': '' }); 1446 var maxHeight = setColumnHeight.getMaxHeight( section ); 1447 if( ( windowWidth <= tabletLandscape && $column.hasClass('grve-tablet-column-1') ) || windowWidth <= tabletPortrait ) { 1448 $column.css({ 'padding-top': '', 'padding-bottom': '', 'min-height': '', 'visibility': 'visible' }); 1449 section.find('.wpb_column').css({ 'visibility': 'visible' }); 1450 } else { 1451 $column.each(function(){ 1452 var columnHeigth = $(this).outerHeight(); 1453 if( columnHeigth <= maxHeight ) { 1454 var space = ( maxHeight - columnHeigth ) / 2; 1455 $(this).css({ 'padding-top' : space, 'padding-bottom' : space }); 1456 } 1457 }); 1458 section.find('.wpb_column').css({ 'visibility': 'visible' }); 1459 } 1460 }); 1461 } 1462 1463 }, 1464 getMaxHeight: function( section ){ 1465 var $that = section, 1466 sectionHeight = $that.height(), 1467 maxHeight = sectionHeight; 1468 1469 return maxHeight; 1470 } 1471 }; 1472 $(window).smartresize( function() { 1473 setColumnHeight.init(); 1474 }); 1475 1476 ////////////////////////////////////////////////////////////////////////////////////////////////////// 1477 // CLASSIC ELEMENTS 1478 ////////////////////////////////////////////////////////////////////////////////////////////////////// 1479 var classicElements = { 1480 init: function(){ 1481 //Accordion Toggle 1482 classicElements.accordionToggle(); 1483 1484 // Animation Appear 1485 classicElements.animAppear(); 1486 1487 //Progress Bars 1488 classicElements.progressBars(); 1489 1490 // Tabs 1491 classicElements.tabs(); 1492 1493 // Vc Tabs 1494 classicElements.vcTab(); 1495 1496 // Info Box 1497 classicElements.infoBox(); 1498 1499 // Counters 1500 classicElements.counter(); 1501 1502 // Countdown 1503 classicElements.countdown(); 1504 1505 // Partner Advanced 1506 classicElements.partnerAdvanced(); 1507 1508 // Portfolio Hover 1509 classicElements.portfolioHover(); 1510 1511 // Woo Product 1512 classicElements.wooProduct(); 1513 1514 }, 1515 1516 accordionToggle: function(){ 1517 $('.grve-toggle-wrapper.grve-first-open').each(function(){ 1518 $(this).find('li').first().addClass('active'); 1519 }); 1520 $('.grve-toggle-wrapper li.active').find('.grve-title').addClass('active'); 1521 $('.grve-toggle-wrapper li .grve-title').click(function () { 1522 $(this) 1523 .toggleClass('active') 1524 .next().slideToggle(350); 1525 }); 1526 $('.grve-accordion-wrapper.grve-first-open').each(function(){ 1527 $(this).find('li').first().addClass('active'); 1528 }); 1529 $('.grve-accordion-wrapper li.active').find('.grve-title').addClass('active'); 1530 $('.grve-accordion-wrapper li .grve-title').click(function () { 1531 $(this) 1532 .toggleClass('active').next().slideToggle(350) 1533 .parent().siblings().find('.grve-title').removeClass('active') 1534 .next().slideUp(350); 1535 }); 1536 }, 1537 animAppear: function(){ 1538 if(isMobile.any()) { 1539 $('.grve-animated-item').css('opacity',1); 1540 } else { 1541 $('.grve-animated-item').each(function() {
1542 var timeDelay = $(this).attr('data-delay'); 1543 $(this).appear(function() { 1544 var $that = $(this); 1545 setTimeout(function () { 1546 $that.addClass('grve-animated'); 1547 }, timeDelay); 1548 },{accX: 0, accY: -150}); 1549 }); 1550 } 1551 }, 1552 progressBars: function(){ 1553 var selector = '.grve-progress-bar'; 1554 $(selector).each(function() { 1555 $(this).appear(function() { 1556 1557 var val = $(this).attr('data-value'), 1558 percentage = $('<div class="grve-percentage">'+ val + '%'+'</div>'); 1559 1560 $(this).find('.grve-bar-line').animate({ width: val + '%' }, 1600); 1561 1562 percentage.appendTo($(this).find('.grve-bar')); 1563 1564 $(this).find('.grve-percentage').animate({ left: val + '%' }, 1600); 1565 }); 1566 }); 1567 }, 1568 tabs: function(){ 1569 $('.grve-tabs-title li').click(function () { 1570 $(this).addClass('active').siblings().removeClass('active'); 1571 $(this).parent().parent().find('.grve-tabs-wrapper').find('.grve-tab-content').eq($(this).index()).addClass('active').siblings().removeClass('active'); 1572 }); 1573 $('.grve-tabs-title').each(function(){ 1574 $(this).find('li').first().click(); 1575 }); 1576 }, 1577 vcTab: function(){ 1578 1579 var $tab = $('.vc_tta-tab a, .vc_tta-panel-title a'); 1580 1581 $tab.on('click', function(){ 1582 var $that = $(this), 1583 link = $that.attr('href'), 1584 $panel = $(link), 1585 $iso = $panel.find('.grve-isotope'); 1586 if( $iso.length > 0 ){ 1587 setTimeout(function() { 1588 $iso.find('.grve-isotope-container').isotope('layout'); 1589 },1000); 1590 } 1591 }); 1592 }, 1593 infoBox: function(){ 1594 var infoMessage = $('.grve-message'), 1595 closeBtn = infoMessage.find($('.grve-close')); 1596 closeBtn.click(function () { 1597 $(this).parent().slideUp(150); 1598 }); 1599 }, 1600 counter: function(){ 1601 var selector = '.grve-counter-item span'; 1602 $(selector).each(function(i){ 1603 var elements = $(selector)[i], 1604 thousandsSeparator = $(this).attr('data-thousands-separator') != '' ? $(this).attr('data-thousands-separator') : ','; 1605 $(elements).attr('id','grve-counter-' + i ); 1606 var delay = $(this).parents('.grve-counter').attr('data-delay') !== '' ? parseInt( $(this).parents('.grve-counter').attr('data-delay') ) : 200, 1607 options = { 1608 useEasing : true, 1609 useGrouping : true, 1610 separator : $(this).attr('data-thousands-separator-vis') != 'yes' ? thousandsSeparator : '', 1611 decimal : $(this).attr('data-decimal-separator') != '' ? $(this).attr('data-decimal-separator') : '.', 1612 prefix : $(this).attr('data-prefix') != '' ? $(this).attr('data-prefix') : '', 1613 suffix : $(this).attr('data-suffix') != '' ? $(this).attr('data-suffix') : '' 1614 }, 1615 counter = new countUp( $(this).attr('id') , $(this).attr('data-start-val'), $(this).attr('data-end-val'), $(this).attr('data-decimal-points'), 2.5, options); 1616 $(this).appear(function() { 1617 setTimeout(function () { 1618 counter.start(); 1619 }, delay); 1620 }); 1621 }); 1622 }, 1623 countdown: function(){ 1624 $('.grve-countdown').each(function() { 1625 var $this = $(this), 1626 finalDate = $this.data('countdown'), 1627 numbersSize = $this.data('numbers-size'), 1628 textSize = $this.data('text-size'), 1629 numbersColor = $this.data('numbers-color'), 1630 textColor = $this.data('text-color'), 1631 countdownItems = '', 1632 text = '', 1633 countdownFormat = $this.data('countdown-format').split('|'); 1634 1635 $.each( countdownFormat, function( index, value ) { 1636 switch (value) { 1637 case 'w': 1638 text = grve_main_data.grve_string_weeks; 1639 break; 1640 case 'D': 1641 case 'd': 1642 case 'n': 1643 text = grve_main_data.grve_string_days; 1644 break; 1645 case 'H': 1646 text = grve_main_data.grve_string_hours; 1647 break; 1648 case 'M': 1649 text = grve_main_data.grve_string_minutes; 1650 break; 1651 case 'S': 1652 text = grve_main_data.grve_string_seconds; 1653 break; 1654 default: 1655 text = ''; 1656 } 1657 countdownItems += '<div class="grve-countdown-item">' 1658 countdownItems += '<div class="grve-number grve-' + numbersSize + ' grve-color-' + numbersColor + '">%' + value + '</div>'; 1659 countdownItems += '<span class="grve-' + textSize + ' grve-color-' + textColor + '">
1659' + text + '</span>'; 1660 countdownItems += '</div>'; 1661 1662 }); 1663 1664 $this.countdown(finalDate, function(event) { 1665 $this = $(this).html(event.strftime( countdownItems )); 1666 }); 1667 }); 1668 }, 1669 partnerAdvanced: function(){ 1670 var partner = $('.grve-partner-advanced'); 1671 1672 partner.parents('.grve-section').hover(function(){ 1673 $(this).css('cursor','pointer'); 1674 }); 1675 1676 partner.parents('.grve-section').on('click',function(){ 1677 var $that = $(this), 1678 $element = $that.find('.grve-partner-advanced'), 1679 offset = $that.offset().top, 1680 headerHeight = 0, 1681 fieldBarHeight = $('.grve-fields-bar').length ? $('.grve-fields-bar').outerHeight() : 0; 1682 1683 if( $('#grve-header').data('sticky-header') != 'none' ){ 1684 if( $('#grve-header').hasClass('grve-logo-top') ) { 1685 headerHeight = $('.grve-bottom-header').outerHeight(); 1686 } else { 1687 headerHeight = $('#grve-inner-header').outerHeight(); 1688 } 1689 } 1690 1691 var distance = offset - ( headerHeight + fieldBarHeight - 1 ); 1692 1693 if( distance > 0 && !$element.hasClass('active') ) { 1694 $('html,body').animate({ 1695 scrollTop: distance 1696 }, 600,function(){ 1697 $element.addClass('active').find('.grve-partner-content').slideDown(function(){ 1698 $(this).addClass('grve-animated'); 1699 return; 1700 }); 1701 }); 1702 } else { 1703 $element.toggleClass('active').find('.grve-partner-content').slideToggle(function(){ 1704 $(this).toggleClass('grve-animated'); 1705 }); 1706 } 1707 1708 }); 1709 }, 1710 iconBox: function(){ 1711 var $parent = $('.grve-row'); 1712 1713 $parent.each(function(){ 1714 var $iconBox = $(this).find('.grve-box-icon.grve-advanced-hover'); 1715 1716 if( !$iconBox.length ) return; 1717 1718 classicElements.setIconBoxHeight( $iconBox ); 1719 $(window).smartresize( function() { 1720 classicElements.setIconBoxHeight( $iconBox ); 1721 }); 1722 1723 $iconBox.unbind('mouseenter mouseleave').bind('mouseenter mouseleave', function() { 1724 $(this).toggleClass('hover'); 1725 }); 1726 1727 }); 1728 }, 1729 setIconBoxHeight: function( element ){ 1730 var arrHeight = [], 1731 $iconBox = element; 1732 1733 1734 $iconBox.css({ 'height' : '', 'padding-top' : '' }); 1735 1736 $iconBox.each(function(){ 1737 var $that = $(this), 1738 $iconBoxHeigth = $that.height(); 1739 1740 arrHeight.push( $iconBoxHeigth ); 1741 }); 1742 1743 var maxHeight = Math.max.apply(Math,arrHeight), 1744 iconHeight = $iconBox.find('.grve-icon').height(), 1745 paddingTop = ( maxHeight - iconHeight )/2; 1746 1747 $iconBox.css({ 'height' : maxHeight, 'padding-top' : paddingTop }); 1748 setTimeout(function() { 1749 $iconBox.addClass('active'); 1750 }, 800); 1751 1752 }, 1753 portfolioHover: function(){ 1754 $(' .grve-portfolio .grve-hover-style-2 ').each( function() { $(this).hoverdir(); } ); 1755 }, 1756 wooProduct: function(){ 1757 var $product = $('.grve-product-item'), 1758 $productOptions = $('.grve-product-options'); 1759 $product.unbind('mouseenter mouseleave').bind('mouseenter mouseleave', function() { 1760 $(this).toggleClass('hover'); 1761 }); 1762 $productOptions.unbind('mouseenter mouseleave').bind('mouseenter mouseleave', function() { 1763 var $addButton = $(this).find('.grve-add-cart'); 1764 if( $addButton.length ){ 1765 $(this).toggleClass('hover'); 1766 } 1767 }); 1768 $('.grve-product-options .grve-add-cart').click(function(){ 1769 $(this).parents('.grve-product-media').addClass('grve-product-added-to-cart'); 1770 }); 1771 } 1772 }; 1773 1774 ////////////////////////////////////////////////////////////////////////////////////////////////////// 1775 // STICKY ELEMENTS 1776 ////////////////////////////////////////////////////////////////////////////////////////////////////// 1777 var stickyItems = { 1778 1779 config : { 1780 element : '.grve-fields-bar', 1781 offset : 0 1782 }, 1783 1784 init: function(settings){ 1785 // allow overriding the default config 1786 $.extend(this.config, settings); 1787 1788 if( !$(this.config.element).length || isMobile.any() || $(this.config.element).hasClass('grve-responsive-bar') ) { 1789 return; 1790 } 1791 var $item = $(this.config.element), 1792 itemOffset = this.config.offset, 1793 positionX = $item.offset().left, 1794 itemId = $item.attr('id'), 1795 itemWidth = $item.outerWidth() + 2, 1796 itemHeight = $item.outerHeight(); 1797 // Create A Helper Wrapper 1798 $item.wrap('<div id="' + itemId + '-wrapper"></div>' ); 1799 $item.parent().css({ 1800 'height' : itemHeight, 1801 'position' : 'relative' 1802 }); 1803 $(window).scroll(function(){ 1804 var scroll = $(window).scrollTop(), 1805 elementTop = $item.parent().offset().top, 1806 headerHeight = 0; 1807 1808 if( $('#grve-header').data('sticky-header') != 'none' ){ 1809 if( $('#grve-header').hasClass('grve-logo-top') ) { 1810 headerHeight = $('.grve-bottom-header').outerHeight(); 1811 } else { 1812 headerHeight = $('#grve-inner-header').outerHeight(); 1813 } 1814 } 1815 1816 var offsetTop = headerHeight + itemOffset + wpBarHeight; 1817 if( scroll > elementTop - offsetTop ) { 1818 $item.css({ 1819 'position' : 'fixed', 1820 'top' : offsetTop, 1821 'left' : positionX, 1822 'width' : itemWidth 1823 }).addClass('sticky'); 1824 } 1825 else { 1826 $item.css({ 1827 'position' : '', 1828 'top' : '', 1829 'left' : '', 1830 'width' : '' 1831 }).removeClass('sticky'); 1832 } 1833 }); 1834 } 1835 }; 1836 1837 ////////////////////////////////////////////////////////////////////////////////////////////////////// 1838 // TITLE PARALLAX 1839 ////////////////////////////////////////////////////////////////////////////////////////////////////// 1840 var titleParallax = { 1841 1842 selector: '.grve-feature-content', 1843 container: '#grve-feature-section', 1844 1845 init: function(){ 1846 if( isMobile.any() || $(this.container).data('effect') != 'parallax' ) { 1847 return; 1848 } 1849 $(window).scroll(function(){ 1850 titleParallax.update(); 1851 }); 1852 }, 1853 update: function(){ 1854 1855 $(this.selector).transition({ y: $(window).scrollTop()*.5},0) 1856 .css( 'opacity', 1 - ( $(window).scrollTop()*.002 ) ); 1857 } 1858 }; 1859 ////////////////////////////////////////////////////////////////////////////////////////////////////// 1860 // ONEPAGE SETTINGS 1861 ////////////////////////////////////////////////////////////////////////////////////////////////////// 1862 var onePageSettings = { 1863 init: function(){ 1864 var topOffset = 0; 1865 if( $('#grve-header').data('sticky-header') != 'none' ){ 1866 if( $('#grve-header').hasClass('grve-logo-top') ) { 1867 topOffset = $('.grve-bottom-header').outerHeight(); 1868 } else { 1869 topOffset = $('#grve-inner-header').outerHeight(); 1870 } 1871 } 1872 var fieldBarHeight = $('.grve-fields-bar').length ? $('.grve-fields-bar').outerHeight() : 0; 1873 1874 $('a[href*="#"]:not( [href="#"] )').click(function(e) { 1875 if (location.pathname.replace(/^\//,'') == this.pathname.replace(/^\//,'') && location.hostname == this.hostname ) { 1876 var target = $(this.hash); 1877 target = target.length ? target : $('[name=' + this.hash.slice(1) +']'); 1878 if ( target.length && ( target.hasClass('grve-section') || target.hasClass('grve-bookmark') ) ) { 1879 $('html,body').animate({ 1880 scrollTop: target.offset().top - topOffset - fieldBarHeight + 1 1881 }, 1000); 1882 return false;
1883 } 1884 } 1885 }); 1886 if (window.location.hash) { 1887 setTimeout(function() { 1888 $('html, body').scrollTop(0); 1889 $('#grve-main-content').css('opacity',1); 1890 var target = window.location.hash; 1891 1892 if ($(target).length) { 1893 $('html, body').delay(600).animate({ 1894 scrollTop: $(target).offset().top - topOffset - fieldBarHeight 1895 }, 600); 1896 } 1897 window.location.hash = ""; 1898 }, 0); 1899 } 1900 else { 1901 $('#grve-main-content').css('opacity',1); 1902 } 1903 } 1904 }; 1905 ////////////////////////////////////////////////////////////////////////////////////////////////////// 1906 // CAROUSEL 1907 ////////////////////////////////////////////////////////////////////////////////////////////////////// 1908 var carousels = { 1909 1910 init: function() { 1911 var $elements = $('.grve-carousel-element'); 1912 1913 $elements.each(function(){ 1914 var carousel = $(this); 1915 1916 var carouselSettings = { 1917 sliderSpeed : ( parseInt( carousel.attr('data-slider-speed') ) ) ? parseInt( carousel.attr('data-slider-speed') ) : 3000, 1918 paginationSpeed : ( parseInt( carousel.attr('data-pagination-speed') ) ) ? parseInt( carousel.attr('data-pagination-speed') ) : 400, 1919 autoHeight : carousel.attr('data-slider-autoheight') == 'yes' ? true : '', 1920 sliderPause : carousel.attr('data-slider-pause') == 'yes' ? true : false, 1921 autoPlay : carousel.attr('data-slider-autoplay') != 'no' ? true : false, 1922 itemNum : carousel.hasClass('grve-carousel') ? parseInt( carousel.attr('data-items')) : 1, 1923 itemsTablet : carousel.hasClass('grve-carousel') ? [768,2] : [768,1], 1924 baseClass : 'grve-carousel', 1925 pagination : false 1926 }; 1927 if ( carousel.hasClass('grve-testimonial') ) { 1928 // Testimonial Navigation 1929 carouselSettings.pagination = true; 1930 } 1931 else if ( carousel.hasClass('grve-carousel') ) { 1932 // Custom Navigation 1933 carousels.customNav(carousel); 1934 } 1935 else if ( carousel.hasClass('grve-slider') ) { 1936 // Custom Navigation 1937 carousels.customNav(carousel); 1938 carousels.customPause(carousel, carouselSettings); 1939 } 1940 // Carousel Settings
1941 carousels.carouselInit(carousel, carouselSettings); 1942 }); 1943 1944 }, 1945 carouselInit: function(carousel, settings){ 1946 carousel.owlCarousel({ 1947 1948 navigation : false, 1949 pagination : settings.pagination, 1950 autoHeight : settings.autoHeight, 1951 slideSpeed : 400, 1952 paginationSpeed : settings.paginationSpeed, 1953 singleItem : false, 1954 items : settings.itemNum, 1955 autoPlay : settings.autoPlay, 1956 stopOnHover : settings.sliderPause, 1957 baseClass : 'grve-carousel-element', 1958 theme : '', 1959 itemsDesktop : false, 1960 itemsDesktopSmall : false, 1961 itemsTablet : settings.itemsTablet 1962 1963 }); 1964 // Carousel Element Speed 1965 if( settings.autoPlay == true ){ 1966 carousel.trigger('owl.play',settings.sliderSpeed); 1967 } 1968 carousel.css('visibility','visible'); 1969 1970 var $parentSection = $(carousel.parents('.grve-section')), 1971 heightMode = $parentSection.attr('data-full-height'); 1972 1973 if( heightMode == 'yes' ) { 1974 sectionSettings.fullHeight($parentSection); 1975 } 1976 }, 1977 customNav: function(carousel){ 1978 // Carousel Navigation 1979 carousel.parent().find('.grve-carousel-next').click(function(){ 1980 carousel.trigger('owl.next'); 1981 }); 1982 carousel.parent().find('.grve-carousel-prev').click(function(){ 1983 carousel.trigger('owl.prev'); 1984 }); 1985 }, 1986 // Fixed Pause on Hover ( Slider with Custom Title ) 1987 customPause: function(carousel, settings){ 1988 var customTitle = carousel.parent().find('.grve-custom-title-wrapper'); 1989 if(settings.sliderPause){ 1990 customTitle.hover(function(){ 1991 carousel.trigger('owl.stop'); 1992 carousel.find('.grve-image-hover').addClass('hover'); 1993 },function(){ 1994 carousel.trigger('owl.play',settings.sliderSpeed); 1995 carousel.find('.grve-image-hover').removeClass('hover'); 1996 }); 1997 } 1998 if(customTitle.length){ 1999 customTitle.hover(function(){ 2000 carousel.find('.grve-image-hover').addClass('hover'); 2001 },function(){ 2002 carousel.find('.grve-image-hover').removeClass('hover'); 2003 }); 2004 } 2005 } 2006 }; 2007 ////////////////////////////////////////////////////////////////////////////////////////////////////// 2008 // ISOTOPE SPINNER 2009 ////////////////////////////////////////////////////////////////////////////////////////////////////// 2010 var isoSpinner = { 2011 init: function(){ 2012 var $selector = $('.grve-isotope'); 2013 $selector.each(function(){ 2014 var $that = $(this), 2015 dataSpinner = $that.data('spinner'); 2016 if( dataSpinner == 'yes' ){ 2017 isoSpinner.addSpinner( $that ); 2018 } 2019 2020 }); 2021 }, 2022 addSpinner: function( $that ){
2023 var $spinner = $('<div class="grve-iso-spinner" title="2"><svg version="1.1" id="spinner" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" width="60px" height="60px" viewBox="0 0 50 50" style="enable-background:new 0 0 50 50;" xml:space="preserve"><path fill="#000" d="M43.935,25.145c0-10.318-8.364-18.683-18.683-18.683c-10.318,0-18.683,8.365-18.683,18.683h4.068c0-8.071,6.543-14.615,14.615-14.615c8.072,0,14.615,6.543,14.615,14.615H43.935z"><animateTransform attributeType="xml" attributeName="transform" type="rotate" from="0 25 25" to="360 25 25" dur="0.6s" repeatCount="indefinite"/></path></svg></div>'); 2024 $spinner.appendTo( $that ); 2025 }, 2026 removeSpinner: function( $container ){ 2027 $container.parent().find('.grve-iso-spinner').animate({'opacity':0},600,function(){ 2028 $container.animate({'opacity': 1},600); 2029 }); 2030 } 2031 } 2032 ////////////////////////////////////////////////////////////////////////////////////////////////////// 2033 // ISOTOPE 2034 ////////////////////////////////////////////////////////////////////////////////////////////////////// 2035 var iso = { 2036 2037 init: function() { 2038 var $selector = $('.grve-isotope'); 2039 $selector.each(function(){ 2040 var $that = $(this), 2041 $container = $that.find('.grve-isotope-container'), 2042 $isotopItem = $container.find('.grve-isotope-item'), 2043 layout = $that.data('layout') != '' ? $that.data('layout') : 'fitRows', 2044 dataSpinner = $that.data('spinner'); 2045 2046 iso.isotopeSetup( $container, layout, dataSpinner ); 2047 $(window).smartresize( function() { 2048 if(layout == 'packery') { 2049 iso.packeryStyleFix( $container ); 2050 } 2051 }); 2052 $that.find('.grve-filter li').click(function(){ 2053 var selector = $(this).attr('data-filter'); 2054 $container.isotope({ 2055 filter: selector 2056 }); 2057 $(this).addClass('selected').siblings().removeClass('selected'); 2058 }); 2059 }); 2060 }, 2061 isotopeSetup: function( $container, layout, dataSpinner ){ 2062 $container.isotope({ 2063 resizable: true, 2064 itemSelector: '.grve-isotope-item', 2065 layoutMode: layout 2066 }); 2067 if(layout == 'packery') { 2068 iso.packeryStyleFix( $container ); 2069 } 2070 $container.isotope('layout'); 2071 if( dataSpinner == 'yes' ) { 2072 setTimeout(function() { 2073 isoSpinner.removeSpinner( $container ); 2074 },2000); 2075 } else { 2076 $container.animate({'opacity': 1},600); 2077 } 2078 2079 $(window).smartresize( function() { 2080 setTimeout(function() { 2081 $container.isotope('layout'); 2082 },1000); 2083 }); 2084 }, 2085 packeryStyleFix: function( $container ) { 2086 var smallItem = $container.find('.grve-isotope-item.grve-packery-image').first(), 2087 standardHeight = smallItem.width(), 2088 wideTallHeight = (standardHeight * 2) + parseInt(smallItem.css('margin-bottom'), 10); 2089 if (standardHeight > 0) { 2090 $container.find('.grve-isotope-item.grve-packery-image .grve-media').css('height', standardHeight); 2091 $container.find('.grve-isotope-item.grve-packery-w2 .grve-media').css('height', standardHeight); 2092 $container.find('.grve-isotope-item.grve-packery-h2 .grve-media').css('height', wideTallHeight); 2093 $container.find('.grve-isotope-item.grve-packery-h2-w2 .grve-media').css('height', wideTallHeight); 2094 } 2095 $container.isotope('layout'); 2096 } 2097 }; 2098 2099 ////////////////////////////////////////////////////////////////////////////////////////////////////// 2100 // NON ISOTOPE FILTER 2101 ////////////////////////////////////////////////////////////////////////////////////////////////////// 2102 var noniso = { 2103 2104 init: function() { 2105 var $selector = $('.grve-non-isotope'); 2106 $selector.each(function(){ 2107 var $that = $(this); 2108 $that.find('.grve-filter li').click(function(){ 2109 var selector = $(this).attr('data-filter'); 2110 if ( '*' == selector ) { 2111 $that.find('.grve-non-isotope-item').fadeIn('1000'); 2112 } else { 2113 $that.find('.grve-non-isotope-item').hide(); 2114 $that.find(selector).fadeIn('1000'); 2115 } 2116 $(this).addClass('selected').siblings().removeClass('selected'); 2117 }); 2118 }); 2119 } 2120 }; 2121 ////////////////////////////////////////////////////////////////////////////////////////////////////// 2122 // PARALLAX 2123 ////////////////////////////////////////////////////////////////////////////////////////////////////// 2124 var parallax = { 2125 2126 selector : 'div[data-stellar-ratio]', 2127 2128 init: function(){ 2129 2130 if( isMobile.any() || !$(this.selector).length ) { 2131 return; 2132 } 2133 2134 $(window).stellar({ 2135 horizontalScrolling: false, 2136 verticalOffset: 0, 2137 horizontalOffset: 0, 2138 responsive: true, 2139 scrollProperty: 'scroll', 2140 positionProperty: 'transform',
2141 parallaxBackgrounds: false, 2142 parallaxElements: true, 2143 hideDistantElements: false, 2144 }); 2145 parallax.settings(); 2146 $(window).smartresize( function() { 2147 parallax.settings(); 2148 }); 2149 }, 2150 settings: function(){ 2151 2152 $(parallax.selector).each(function (){ 2153 var $parallax = $(this), 2154 $container = $parallax.parent(), 2155 containerHeight = $container.outerHeight(), 2156 windowHeight = $(window).height(); 2157 2158 if( 1 == grve_main_data.grve_row_stellar_auto ) { 2159 $parallax.css({ 2160 'height': containerHeight + windowHeight, 2161 'top': -1 * windowHeight * 0.5 / 2 2162 }); 2163 } 2164 2165 if( $parallax.is('.grve-bg-video') ) { 2166 videoResize.init( { selector : $parallax, container : $parallax } ); 2167 } 2168 }); 2169 } 2170 }; 2171 ////////////////////////////////////////////////////////////////////////////////////////////////////// 2172 // GLOBAL VARIABLES 2173 ////////////////////////////////////////////////////////////////////////////////////////////////////// 2174 var wpBarHeight = $('#grve-body').hasClass('admin-bar') ? 32 : 0; 2175 var largeScreen = 2048; 2176 var tabletLandscape = 1200; 2177 var tabletPortrait = 1023; 2178 var mobileScreen = 767; 2179 var isMobile = { 2180 Android: function() { 2181 return navigator.userAgent.match(/Android/i); 2182 }, 2183 BlackBerry: function() { 2184 return navigator.userAgent.match(/BlackBerry/i); 2185 }, 2186 iOS: function() { 2187 return navigator.userAgent.match(/iPhone|iPad|iPod/i); 2188 }, 2189 Opera: function() { 2190 return navigator.userAgent.match(/Opera Mini/i); 2191 }, 2192 Windows: function() { 2193 return navigator.userAgent.match(/IEMobile/i); 2194 }, 2195 any: function() { 2196 return (isMobile.Android() || isMobile.BlackBerry() || isMobile.iOS() || isMobile.Opera() || isMobile.Windows()); 2197 } 2198 }; 2199 2200 // Scrollbar Width 2201 var parent, child, scrollBarWidth; 2202 2203 if( scrollBarWidth === undefined ) { 2204 parent = $('<div style="width:50px;height:50px;overflow:auto"><div/></div>').appendTo('body'); 2205 child = parent.children(); 2206 scrollBarWidth = child.innerWidth()-child.height(99).innerWidth(); 2207 parent.remove(); 2208 }; 2209 2210 2211 2212 $(document).ready( function() { 2213 2214 // Remove Video Bg 2215 pageSettings.removeVideoBg(); 2216 2217 // FEATURE SECTION SETTINGS 2218 featureSection.init(); 2219 2220 // HEADER 2221 headerSettings.init(); 2222 2223 // MAIN MENU 2224 mainMenu.init(); 2225 2226 // SIDE MENU 2227 headerOptions.init(); 2228 2229 // CLASSIC ELEMENTS 2230 classicElements.init(); 2231 2232 // PAGE SETTINGS 2233 pageSettings.init(); 2234 2235 // STICKY ELEMENTS 2236 stickyItems.init(); 2237 2238 // POST SOCIALS 2239 pageSettings.postSocials(); 2240 2241 // TITLE PARALLAX 2242 titleParallax.init(); 2243 2244 // SECTIONS 2245 sectionSettings.init(); 2246 2247 // ONEPAGE SETTINGS 2248 onePageSettings.init(); 2249 2250 // ISOTOPE SPINNER 2251 isoSpinner.init(); 2252 2253 }); 2254 2255 $(window).load( function() { 2256 2257 // Icon Box 2258 classicElements.iconBox(); 2259 2260 // Column Height 2261 setColumnHeight.init(); 2262 2263 // CAROUSELS 2264 carousels.init(); 2265 2266 // ISOTOPE 2267 iso.init(); 2268 2269 //NON ISOTOPE FILTER 2270 noniso.init(); 2271 2272 // PARALLAX 2273 parallax.init(); 2274 2275 pageSettings.gotoSection(); 2276 2277 pageSettings.refMainMenu(); 2278 2279 // FIXED FOOTER 2280 pageSettings.fixedFooter(); 2281 2282 pageSettings.sectionBgVideo(); 2283 }); 2284 2285})(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.