I’m trying to instal this plugin called headroom.js on my site and I cannot get it to work.
I have a little bit of experience with installing jquery pluggins but I’m a bit lost trying to apply the same thing using webflow’s interface.
basically all I want to do is to get my navigation bar to hide and show dynamically as you scroll up and down the page.
the pluggins demo site illustrates this perfectly.
here is the plugin’s demo site :
and here is the github page :
so far I tried the following :
I’ve added the scrip links in my footer code field :
Hi there @PixelGeek
Thanks for the tip !
Unfortunately it didn’t work.
this is how my code looks like now :
<script>
$(document).ready(function(){
// simple as this!
// NOTE: init() is implicitly called with the plugin
$("#header").headroom();
}
});
</script>
If you have any other suggestions don’t hesitate to share !
Thanks again.
Thanks @bartekkustra,
I still can’t get it to work even with this edit.
Could it be that I’m missing something else? My navbar is a symbol and I have to double click in order to edit the actual navbar which is where I added my ID name “header”.
I’m still trying various things. Any help is appreciated !
Here is another link of the same example done in codepen here :
I tried bringing in that code as well with no luck.
if anyone could get this to work or create an example on webflow I would be forever grateful !
Maybe (and most probably) it’s because you have your code in <head> section instead of before </body>. In footer code first you have to call your script, then initialize it.
In case that won’t work, try the code below. I haven’t tested that at all but it should work.
Thanks for your help @bartekkustra.
Unfortunately everything I’ve tried doesn’t seem to work at all. I’ve tried with my code in the footer only that didn’t work.
I’ve tried putting my code in the header with no luck.
I’m aware that usually all links to scripts should be before the </body> code but in this case nothing works.
I am convinced it has something to do with the way I labeled my navbar within webflow’s design tool.
I’ve temporarily removed my scripts from the custom code section and going back to the instructions to see if there is any other way I could achieve this effect.