Does anyone know how add to this script?
I need to check whether the visitor is at the top of the page? If not call the fallback script.
E.g. if user is at top of page delay animation, if user is elsewhere remove delay (fallback else condition).
var viewportWidth = $(window).width(),
stopTabletAnimation = 1024,
scrTop;
$(window).on("load scroll", function() {
scrTop = $("html, body").scrollTop();
if (!scrTop && viewportWidth > stopTabletAnimation){
// DELAY ANIMATION - FORCE TOP CORRECTLY (WITH A DELAY - .9s)
$('.website-navigation').delay(3500).animate({top:0}, 900, function() {
// Confirm Above if successful!
console.log('ANIMATION COMPLETE: .site-head Delayed, then loaded!');
});
} else {
// Do Not Animate
$('.website-navigation').css({top: '0'});
console.log('NO ANIMATION: Inforce Set Height');
}
});