Change class of div on scroll

0
I want to be able to change the class of a div on page scroll. Once the class changes then any number of things can be achieved.

For the time being I want to stick the menu to the top and modify other aspects of it's styling. I have tried any number of versions of jQuery scripts for doing this and in isolation, ie a non Joomla page with nothing else on it these nearly all work fine with most versions of jQuery.

The problems arise as soon as I try and use it on a Joomla page.

I am a great fan of these blank templates so I'm hoping there is something I am missing in this

This is the current test page

http://lawandorderfoundation.org

The Javascript I am using on this page is

<script type="text/javascript">
$(window).scroll(function() {
if ($(document).scrollTop() > 10) {
$('nav').addClass('shrink');
} else {
$('nav').removeClass('shrink');
}
});
</script>
Responses (0)
  • There are no replies here yet.
Your Reply