assets/js/blocs.js
// Sticky Nav Bar Toggle On / Off
Sticky Nav Bar Toggle On / Off
Sticky Nav Bar Toggle On / Off
function stickyNavToggle()
{
	var offsetVal = 0; 
	var classes = "sticky"; 
	var targetContainer = $('.page-container');
	var isFillScreenSticky = $('.sticky-nav').hasClass('fill-bloc-top-edge');
	if (isFillScreenSticky) 
	{
		console.log('fill screen');
		targetContainer = $('.fill-bloc-top-edge.sticky-nav').parent();
		offsetVal = $('.sticky-nav').height();
		classes = "sticky animated fadeInDown"; 
	}
	if ($(window).scrollTop() > offsetVal)
	{  
		if (!$('.sticky-nav').hasClass('sticky')) 
		{
			$('.sticky-nav').addClass(classes);
			offsetVal = $('.sticky-nav').height();
			if (isFillScreenSticky)
			{
				var bgColor = targetContainer.css('background-color');
				if (bgColor == "rgba(0, 0, 0, 0)") bgColor = '#FFFFFF';
				$('.sticky-nav').css('background', bgColor);
				offsetVal += parseInt(targetContainer.css('padding-top')); 
			}
			targetContainer.css('padding-top',offsetVal);
		}
	}
	else if ($('.sticky-nav').hasClass('sticky')) 
	{
		$('.sticky-nav').removeClass(classes).removeAttr('style');
		targetContainer.removeAttr('style');
	}	
}
function stickyNavToggle ( ) { var offsetVal = 0 ; var classes = "sticky" ; var targetContainer = $ ( '.page-container' ) ; var isFillScreenSticky = $ ( '.sticky-nav' ) . hasClass ( 'fill-bloc-top-edge' ) ; if ( isFillScreenSticky ) { console . log ( 'fill screen' ) ; targetContainer = $ ( '.fill-bloc-top-edge.sticky-nav' ) . parent ( ) ; offsetVal = $ ( '.sticky-nav' ) . height ( ) ; classes = "sticky animated fadeInDown" ; } if ( $ ( window ) . scrollTop ( ) > offsetVal ) { if ( ! $ ( '.sticky-nav' ) . hasClass ( 'sticky' ) ) { $ ( '.sticky-nav' ) . addClass ( classes ) ; offsetVal = $ ( '.sticky-nav' ) . height ( ) ; if ( isFillScreenSticky ) { var bgColor = targetContainer . css ( 'background-color' ) ; if ( bgColor == "rgba(0, 0, 0, 0)" ) bgColor = '#FFFFFF' ; $ ( '.sticky-nav' ) . css ( 'background' , bgColor ) ; offsetVal += parseInt ( targetContainer . css ( 'padding-top' ) ) ; } targetContainer . css ( 'padding-top' , offsetVal ) ; } } else if ( $ ( '.sticky-nav' ) . hasClass ( 'sticky' ) ) { $ ( '.sticky-nav' ) . removeClass ( classes ) . removeAttr ( 'style' ) ; targetContainer . removeAttr ( 'style' ) ; } }
Sticky Nav Bar Toggle On / Off
Sticky Nav Bar Toggle On / Off
// offset Value // Classes // Nav in hero Bloc // Add Sticky // Set BG Color // Remove Sticky