React when elements are in view.
React when elements are in view.
$ bower i jquery-beacons
$ npm i jquery-beacons
var $ = require('jquery');
require('jquery-beacons');
$('.widget').beacon({..});
<script src="path/to/jquery.js"></script>
<script src="path/to/jquery-beacons.min.js"></script>
<script>
$('.widget').beacon({..});
</script>
Beacons are page elements you want to act on when they scroll into view.
$('.widget').beacon({
onenter: function (el) {
alert('Widget ' + el.id + ' is on screen!');
}
});
$('.widget').beacon({
enteronce: true,
onenter: function () {
alert('A widget is visible!');
}
});
Event when beacon enters the viewport.
True to trip onenter event only once.
Event when beacon leaves the viewport.
True to trip onexit event only once.
Pixels from top and bottom of viewport to trigger this beacon.
$(.widget).beacon('enable');
$(.widget).beacon('disable');
$(.widget).beacon('destroy');