My goal is to create a scrolling effect where the header text moves down slightly, adding some margin on top to keep it in view.
I found the perfect example of what I want to achieve with the header text at this website:
After spending hours working on it, I have only been able to achieve something similar to this example:
The code used in the example is as follows:
$(window).scroll(function(){
var fromTop = $(window).scrollTop();
$(".logo").css('margin', '-' + (100 - fromTop) + 'px 0px 0px 0px');
});
However, I am struggling to replicate the effect shown in the first link. Can anyone provide guidance on how to adjust the JavaScript to achieve a similar effect?