• Hello,
    I am building a custom WordPress theme which is still in development.(no link available). I am using Bootstrap 5. I created a transparent header(there is a hero image on the homepage) that fills with a background color(using javascript) – on scroll.
    My question is – is there a way to only have that functionality on the homepage and not any other pages? They do not have hero images so the nav background can be a solid color.

    • This topic was modified 2 years, 9 months ago by Jan Dembowski. Reason: Moved to Fixing WordPress, this is not an Developing with WordPress topic
Viewing 2 replies - 1 through 2 (of 2 total)
  • If you’ve done it using CSS, use .home as a seelctor before anything else and that will target the home page. As a very bad example:

    .nav-background {
        background: #FF0000;
    }
    .home .nav-background {
        background: transparent;
    }

    If you’re doing it through JavaScript then you’d need to look at the code that’s doing the work and see if there’s anything that can be changed or updated.

    Thread Starter kevinritt

    (@kevinritt)

    Thank you @catacaustic I will try this out.

    Kevin

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Transparent nav on homepage only’ is closed to new replies.