Skip to content

Commit

Permalink
michalsnik#26 - attach event lister to window for event
Browse files Browse the repository at this point in the history
  • Loading branch information
Michał Sajnóg committed Aug 31, 2016
1 parent 1de25f6 commit 67db35c
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/js/aos.js
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,11 @@ const init = function init(settings) {
['complete', 'interactive'].indexOf(document.readyState) > -1) {
// Initialize AOS if default startEvent was already fired
refresh(true);
} else if (options.startEvent === 'load') {
// If start event is 'Load' - attach listener to window
window.addEventListener(options.startEvent, function() {
refresh(true);
});
} else {
// Listen to options.startEvent and initialize AOS
document.addEventListener(options.startEvent, function() {
Expand Down

0 comments on commit 67db35c

Please sign in to comment.