I am a jQuery beginner and would like some pointers on whether the following code could be made shorter, or there is a better way to get the same result.
jQuery(document).ready(function(){
var aa=jQuery('#navigation-wrapper');
var bb=jQuery('#top');
jQuery(window).scroll(function(){
if(jQuery("body").hasClass("home")){
if(jQuery(this).scrollTop()>510){
aa.addClass("navbar-fixed-top");
//bb.css('marginTop', aa.height());
}
else{
aa.removeClass("navbar-fixed-top");
//bb.css('marginTop', 0);
}
}
else {
if(jQuery(this).scrollTop()>293){
aa.addClass("navbar-fixed-top");
//bb.css('marginTop', aa.height());
}
else{
aa.removeClass("navbar-fixed-top");
//bb.css('marginTop', 0);
}
}
});
});