I was wondering if someone could help me out. I am currently developing a wordpress theme using foundation framework on a local host and I would like for the top-bar to change styles on scroll using jquery. I have found that a good solution would be to .addClass or .removeClass based on how far from the top the user scrolls. I have added .active to the .top-bar class in my css. For the jquery code i have put my code in a no conflict wrapper, because wordpress requires you to do so. I have attached my code below, but it doesn't seem to be working at all. My jquery does not get any errors when i test it in JSFiddle, but when i test it using my chrome developer tools i get an error in my jquery, please find the error on commented out in the code below:
My Jquery
jQuery(window).on("scroll", function($) {
if($(window).scrollTop() > 50) { //Uncaught TypeError: $ is not a function
$(".top-bar").addClass("active");
} else {
$(".top-bar").removeClass("active");
}
});
My CSS
.top-bar.active{
background: blue;
-webkit-box-shadow: 0 1px 5px rgba(0, 0, 0, 0.25);
-moz-box-shadow: 0 1px 5px rgba(0, 0, 0, 0.25);
box-shadow: 0 1px 5px rgba(0, 0, 0, 0.25);
}