Skip to content

Commit

Permalink
Added scroll functions
Browse files Browse the repository at this point in the history
  • Loading branch information
arguiot committed Jul 25, 2017
1 parent f0ad177 commit b586ab5
Show file tree
Hide file tree
Showing 6 changed files with 38 additions and 3 deletions.
9 changes: 9 additions & 0 deletions dist/display.es6.js
Original file line number Diff line number Diff line change
Expand Up @@ -314,6 +314,15 @@ class DisplayJS {
document.addEventListener("DOMContentLoaded", fn);
}
}
scroll (callback) {
window.addEventListener("scroll", callback);
}
scrollTo (x, y) {
window.scroll(x, y);
}
scrollTop (el = [document.body]) {
return el[0].scrollTop;
}
show(element) {
element[0].style.display = "block";
return true;
Expand Down
2 changes: 1 addition & 1 deletion dist/display.es6.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

17 changes: 17 additions & 0 deletions dist/display.js
Original file line number Diff line number Diff line change
Expand Up @@ -406,6 +406,23 @@ var DisplayJS = function () {
document.addEventListener("DOMContentLoaded", fn);
}
}
}, {
key: "scroll",
value: function scroll(callback) {
window.addEventListener("scroll", callback);
}
}, {
key: "scrollTo",
value: function scrollTo(x, y) {
window.scroll(x, y);
}
}, {
key: "scrollTop",
value: function scrollTop() {
var el = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [document.body];

return el[0].scrollTop;
}
}, {
key: "show",
value: function show(element) {
Expand Down
Loading

0 comments on commit b586ab5

Please sign in to comment.