I'm trying to change the navbar background on pagescroll.

So on the homepage the background is transparant with logo.png and when the user scrolls down, the background of the navbar changes to white and logo2.png is loaded.

An example:

https://instapage.com/

I found several codesnippets but i can't get it to work on Drupal Bootstrap.

Does anyone have a working code for Drupal?

Thank you!

Comments

mindhunter75 created an issue. See original summary.

mindhunter75’s picture

I found out that the java file needs to be wrapped in:

(function ($, Drupal, window) {
// code here
})(jQuery, Drupal, window);

That's why the code didn't work!

I can now add a class to the navbar default.
But i don't know how to change the logo on scroll.

markhalliwell’s picture

Status: Active » Closed (won't fix)

Closing per https://drupal-bootstrap.org/api/bootstrap/docs%21Contributing.md/group/...

Reason: site specific (requires custom CSS/JS)