{"action":"created","issue":{"url":"https://api.github.com/repos/idiotWu/smooth-scrollbar/issues/55","repository_url":"https://api.github.com/repos/idiotWu/smooth-scrollbar","labels_url":"https://api.github.com/repos/idiotWu/smooth-scrollbar/issues/55/labels{/name}","comments_url":"https://api.github.com/repos/idiotWu/smooth-scrollbar/issues/55/comments","events_url":"https://api.github.com/repos/idiotWu/smooth-scrollbar/issues/55/events","html_url":"https://github.com/idiotWu/smooth-scrollbar/issues/55","id":204322203,"number":55,"title":"(scroll to top) how to detect when the scroll bar is past header to show button","user":{"login":"ChazyTheBest","id":654229,"avatar_url":"https://avatars.githubusercontent.com/u/654229?v=3","gravatar_id":"","url":"https://api.github.com/users/ChazyTheBest","html_url":"https://github.com/ChazyTheBest","followers_url":"https://api.github.com/users/ChazyTheBest/followers","following_url":"https://api.github.com/users/ChazyTheBest/following{/other_user}","gists_url":"https://api.github.com/users/ChazyTheBest/gists{/gist_id}","starred_url":"https://api.github.com/users/ChazyTheBest/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ChazyTheBest/subscriptions","organizations_url":"https://api.github.com/users/ChazyTheBest/orgs","repos_url":"https://api.github.com/users/ChazyTheBest/repos","events_url":"https://api.github.com/users/ChazyTheBest/events{/privacy}","received_events_url":"https://api.github.com/users/ChazyTheBest/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2017-01-31T14:59:18Z","updated_at":"2017-01-31T18:22:03Z","closed_at":null,"body":"I'm using a (mini) jquery plugin to scroll to top (alongside jquery.easing) when the user scrolls past the header so he/she can easily return to top. The thing is, this javascript plugin does not trigger the normal scroll event and the button never appears. I'd love to remove both jquery plugins and only use smooth-scrollbar :)\r\n\r\n```javascript\r\n$().UItoTop({\r\n    easingType: 'easeOutQuart'\r\n});\r\n```\r\n\r\nI now have to manually listen to the click event of the button (I'll use jquery for this) and using the smooth-scrollbar method `instance#scrollTo( x, y, [duration], [callback] )` to do the scrolling.\r\n\r\nWhat i don't know is how to check when the scroll bar is past the `<header>` element so that I can unhide the button `.toTop` (that is hidden while the `<header>` element is visible). Also (if possible) minding the different screen sizes?\r\n\r\n```javascript\r\n$('.toTop').click(function() {\r\n   Scrollbar.scrollTo(0, 0, 300)\r\n});\r\n\r\nif (!Scrollbar.isVisible(document.getElementsByClassName('toTop')[0]) {\r\n    $('.toTop').show();\r\n}\r\n```\r\n\r\nLike that?\r\n\r\nSorry, I'm only familiar with jquery :P\r\n\r\n(Edit)\r\n\r\nAlso, the `<a>` button have `position: fixed` but when I scroll, the element is not fixed, any way to fix this? Should I open a new issue for this?"},"comment":{"url":"https://api.github.com/repos/idiotWu/smooth-scrollbar/issues/comments/276446993","html_url":"https://github.com/idiotWu/smooth-scrollbar/issues/55#issuecomment-276446993","issue_url":"https://api.github.com/repos/idiotWu/smooth-scrollbar/issues/55","id":276446993,"user":{"login":"idiotWu","id":6022672,"avatar_url":"https://avatars.githubusercontent.com/u/6022672?v=3","gravatar_id":"","url":"https://api.github.com/users/idiotWu","html_url":"https://github.com/idiotWu","followers_url":"https://api.github.com/users/idiotWu/followers","following_url":"https://api.github.com/users/idiotWu/following{/other_user}","gists_url":"https://api.github.com/users/idiotWu/gists{/gist_id}","starred_url":"https://api.github.com/users/idiotWu/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/idiotWu/subscriptions","organizations_url":"https://api.github.com/users/idiotWu/orgs","repos_url":"https://api.github.com/users/idiotWu/repos","events_url":"https://api.github.com/users/idiotWu/events{/privacy}","received_events_url":"https://api.github.com/users/idiotWu/received_events","type":"User","site_admin":false},"created_at":"2017-01-31T18:22:03Z","updated_at":"2017-01-31T18:22:03Z","body":"You can use [`.addListener()`](https://github.com/idiotWu/smooth-scrollbar/wiki/Instance-Methods#instanceaddlistener-fn-) method to register a scroll listener.\r\n\r\nAs for the fixed elements, you can check this issue: https://github.com/idiotWu/smooth-scrollbar/issues/49\r\n\r\nBesides, I think this kind of question should be asked in somewhere like stack overflow."}}
{"actor":{"display_login":"idiotWu"}}