user1
8/4/2016 - 5:04 AM

Waypoint enter, exit actions when reaching an element

Waypoint enter, exit actions when reaching an element

var inview = new Waypoint.Inview({
    element: $('.newbane')[0], //when scroll reaches this element do the following
    enter: function (direction) {
        $(".get-started-btn").css({ "right": "-52px" });
    },
    exited: function (direction) {
        $(".get-started-btn").css({ "right": "-5px" });
    }
})

//var inview - variable name can be anything
//new Waypoint.Inview - Its the Waypoint Inview method
<script src="/path/to/lib/jquery.waypoints.min.js"></script>
<script src="/path/to/shortcuts/inview.min.js"></script>