<script src="system/modules/eSM_waypoints/assets/lib/waypoints/<?php echo WAYPOINTS; ?>/assets/js/jquery.waypoints.min.js"></script> <script> (function($) { $(document).ready(function() { var waypoint = { header: new Waypoint({ element: $('#container'), handler: function(direction) { if (direction == 'down') { $('#header').addClass('shrink'); } else { $('#header').removeClass('shrink'); } } }) }; }); })(jQuery); </script>