My webpage features a sticky header that gains an extra .header-scrolled
class when users scroll down. I am looking to switch the logo displayed in the header once it has been scrolled.
Below is a simplified version of my HTML code:
<header class=".header-sticky">
<div class="logo1">
<img src="../image1.jpg">
</div>
<div class="logo2">
<img src="../image2.jpg">
</div>
</header>
Is there a way for me to hide the entire <div class="logo2">
until the .header-scrolled
class is applied to the <header>
, and vice versa - conceal <div class="logo1">
and show <div class="logo2">
when the corresponding class appears after scrolling?