JQuery.waypoint - direction is undefined
I have a problem using waypoint plugin, so many hints like http://webdesign.tutsplus.com/tutorials/javascript-tutorials/create-a-sticky-navigation-header-using-jquery-waypoints/ .
Here is my code:
<script type="text/javascript">
jQuery(function() {
var nav_container = jQuery("#menu-wrapper");
var nav = jQuery("#menu");
nav_container.waypoint(function(event, direction) {
jQuery("#fixed").toggleClass('stickyfixed');
jQuery('#zweitenavigation').toggleClass('invisible');
alert(direction);
var new_height = (direction === "down") ? '92px' : '195px';
jQuery("#header").animate({'height': new_height}, 300);
},{offset:50}
);
});
</script>
The problem is
direction === "down"
doesn't evaluate to true or false, it's just undefined. Therefore, the animation only runs once.
Does anyone have an idea where the problem might be found? ToggleClass works fine.
Thanks for your help and best wishes Stephan
+3
source to share