Skip to content

Commit

Permalink
Update example and component
Browse files Browse the repository at this point in the history
  • Loading branch information
danilvalov committed Jan 10, 2017
1 parent 54e1780 commit 9550fc2
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 7 deletions.
10 changes: 5 additions & 5 deletions component.json
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
{
"name": "scroll-to",
"repo": "component/scroll-to",
"description": "Smooth window scroll to position with requestAnimationFrame",
"version": "0.0.2",
"name": "element-scroll-top",
"repo": "component/element-scroll-top",
"description": "Smooth element scroll to top position with requestAnimationFrame",
"version": "0.0.3",
"keywords": [
"scroll",
"animate",
"scroll-to"
"element-scroll-top"
],
"dependencies": {
"component/raf": "1.2.0",
Expand Down
5 changes: 3 additions & 2 deletions example.html
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@

<script>
var elementScrollTop = require('element-scroll-top');
var events = require('event');
var div = document.querySelector('div');
var ul = document.querySelector('ul');

Expand All @@ -52,13 +53,13 @@
ul.appendChild(li);
}

div.addEventListener('click', function(e){
events.bind(window, 'click', function(e){
var top = e.pageY;

console.log('scrolling div element to %s', top);

elementScrollTop(div, top);
}, false);
});
</script>
</body>
</html>

0 comments on commit 9550fc2

Please sign in to comment.