Try this code
<script type="text/javascript">
$(window).scroll(function(){
var p = $( ".header-after-div-class" );
var position = p.position();
if ($(this).scrollTop() > position.top) {
$('.header').addClass('show');
} else {
$('.header').removeClass('hide');
}
});
</script>
Thanks! In what file do I put this?
If your theme have jquery library file you can put this footer.php
If you don’t have jquery library
<script type="text/javascript" src="http://code.jquery.com/jquery-1.11.2.min.js"></script>
<script type="text/javascript">
$(window).scroll(function(){
var p = $( ".header-after-div-class" );
var position = p.position();
if ($(this).scrollTop() > position.top) {
$('.header').addClass('show');
} else {
$('.header').removeClass('hide');
}
});
</script>
And
1. Add class for just after div tag ‘header-after-div-class’
2. Add class for header container ‘header’
All the very best
Where do I add the class? Same php file?
I’m sorry for my ignorance, webscripting classes are way in the past.