فتحات العرب Joomla! • Index page: Templates for Joomla! 3.x • Change div class on scroll

Monday, April 20, 2015

Templates for Joomla! 3.x • Change div class on scroll

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, i.e. 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 template. Currently using a blank from blank.vc

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://ift.tt/1bjLMo3

The Javascript I am using on this page is

Code:
$(window).scroll(function() {
  if ($(document).scrollTop() > 10) {
    $('nav').addClass('shrink');
  } else {
    $('nav').removeClass('shrink');
  }
});

Statistics: Posted by Donethat — Mon Apr 20, 2015 10:21 am




via Joomla! http://ift.tt/1bjLMo7

No comments:

Post a Comment