I'm trying to hide an image after I scroll down my page. When scrolling my header
gets a class fl-theme-builder-header-scrolled
. My image div has a class hiding-image
and I want to add a class image-off
when the fl-theme-builder-header-scrolled
class shows up in the header
.
This is what I have:
$(document).ready(function() {
if($( 'header' ).hasClass( 'fl-theme-builder-header-scrolled' )) {
$( '.hiding-image' ).toggleClass( 'image-off' );
}
});
but this doesn't work. Any advice? Thx.