Basic example
Based on offset of the element in DOM.
    
    $(".example").scrollTrigger({
      gap: 20,
      on: function () {
        $(".example").addClass("example--fixed");
      },
      off: function () {
        $(".example").removeClass("example--fixed");
      }
    });
      
Example