mirror of
https://github.com/biobulkbende/biobulkbende.org.git
synced 2026-01-02 15:07:30 +00:00
sticky header - lazyload - navbar - floatingpoints
This commit is contained in:
31
app/assets/js/modules/RevealOnScroll.js
Normal file
31
app/assets/js/modules/RevealOnScroll.js
Normal file
@ -0,0 +1,31 @@
|
||||
import $ from 'jquery';
|
||||
import waypoints from '../../../../node_modules/waypoints/lib/noframework.waypoints';
|
||||
|
||||
class RevealOnScroll {
|
||||
constructor(els, offset){
|
||||
this.itemsToReveal = els;
|
||||
this.offsetPercentage = offset;
|
||||
this.hideInitially();
|
||||
this.createWaypoints();
|
||||
}
|
||||
|
||||
hideInitially() {
|
||||
this.itemsToReveal.addClass("reveal-item");
|
||||
}
|
||||
|
||||
createWaypoints() {
|
||||
var that = this;
|
||||
this.itemsToReveal.each( function(){
|
||||
var currentItem = this;
|
||||
new Waypoint({
|
||||
element: currentItem,
|
||||
handler: function() {
|
||||
$(currentItem).addClass("reveal-item--is-visible");
|
||||
},
|
||||
offset: that.offsetPercentage
|
||||
});
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
export default RevealOnScroll;
|
||||
Reference in New Issue
Block a user