Hello
Thank you for your precious help on this forum.
I would like my logo on my navigation bar to change size on my homepage when scrolling and this script is what I am looking for. So I placed this one in my footer homepage :
It doesn’t work in preview mode on Blocs but it works very well in preview mode in browser. On the other hand, as soon as I upload the files on my server and access my site via a browser it doesn’t work.
You can see it on : www.lemoulinduboisset.com
There are a couple of ways. You can use the same script and modify it, to add some inline CSS, to change the width and height, or you could use transform scale.
That would look something like…
Replace the two var for the logo with
var logo = document.getElementsByClassName("navbar-brand")[0];
Replace both actions that change the src with the following line, and adjust the scale to suit.
logo.style.transform = "scale(1)";
To go smaller replace the 1 to something like 0.7 etc.
I haven’t tested this, but I am also about to head off to bed.
Great it works well only in preview mode but not in a browser. And I would also like my navigation bar to have the reduced size as you can see on the other website pages.
Hello
It’s really strange. It doesn’t work on a browser, only in preview mode. But when I click on the Logo, its size decreases. You can try: www.lemoulinduboisset.com.
Yet I didn’t put any action on the Logo.
Need some help, please ?
Thanks a lot
Hi! still not working for me. I’m using Blocs 5.2 , could someone explain step by step how to resize the navbar bloc (logo and menu) when scroll down the webpage?
I can do resize adding this class " .sticky navbar-brand img " to logo changing the Width but it’s not smooth…
Maybe with a tutorial would be great.
Thanks in advance