I have a pulsing button (#scrollarrow) at the bottom of my website that disappears as I start scrolling. The jQuery code responsible for this effect is as follows:
$(document).ready(function(){
$(window).scroll(function(){
if ($(this).scrollTop() > 50) {
$('#scrollarrow').fadeOut('slow');
}else{
$('#scrollarrow').fadeIn('slow');
}
});
});
Everything works fine up to this point. However, when I try to add a pulse effect (a simple change of opacity), things get tricky:
function pulse(){
$('#scrollarrow').delay(200).fadeOut('slow').delay(50).fadeIn('slow',pulse);
}
The problem arises when trying to integrate this function into the existing code. The result I achieve is seeing the button pulse after scrolling, which is the opposite of what I intended. Despite attempting various combinations, none seem to provide the desired outcome.
If anyone has any suggestions or solutions, please share them with me. Thank you!