follow-me.js

JS Plugins JavaScript
On branch current
Latest: ???/cur
Running: c4c9be7 (v1.0.15)
??? commits behind

Makes an element follow you within the bounds of a container as you scroll.

Usage

Activate follow-me.js using $('#follow-me').follow().

<div id="container" class="follow-container">
  <div id="follow-me" class="follow">
  </div>
</div>
#follow-me {
  position: absolute;
}
$('#follow-me').follow();

Options

Pass in options like this:

$('#follow-me').follow({
  container: 'my-container-name'
});
OptionTypeDefaultDescription
containerStringcontainerID of the containing element.
speedInteger500Animation speed in milliseconds.
offsetInteger0Offset from the top. Ignored if offsetElement is set.
offsetElementStringnullIf set, uses the height of this element as an offset.
minIntegernullMinimum screen width to enable this plugin.
maxIntegernullMaximum screen width to enable this plugin.

Events

Use events like this:

$('#follow-me').follow({
  topStart: myFunction
});
EventDescription
topStartFires when moving to the top.
topEndFires when the top has been reached.
bottomStartFires when moving to the bottom.
bottomEndFires when the bottom has been reached.
movingStartFires when moving.
movingEndFires when moving stops.