In YUI I have following code working for mouse wheel. How do I make this work for a scrollbar?
Y.on('mousewheel', function(e) {
var dir = e.wheelDelta > 0 ? 'Up' : 'Down';
console.log(dir);
});
Thanks for any help...
In YUI I have following code working for mouse wheel. How do I make this work for a scrollbar?
Y.on('mousewheel', function(e) {
var dir = e.wheelDelta > 0 ? 'Up' : 'Down';
console.log(dir);
});
Thanks for any help...
Share Improve this question edited Nov 1, 2012 at 19:01 Gregg B 13.8k6 gold badges35 silver badges52 bronze badges asked Jun 20, 2012 at 8:43 TroodoN-MikeTroodoN-Mike 16.2k15 gold badges59 silver badges78 bronze badges 3- The browser manages the scrollbars, so why would you need to write Javascript to react to the SB??? – Mörre Commented Jun 20, 2012 at 9:05
- i need data (position) when user is using scrollbar. For code above i get data but only when i use mouse wheel. I want include receiving data when user is interacting with scrollbar on the right – TroodoN-Mike Commented Jun 20, 2012 at 9:32
- So what's the problem? Look for an event that is fired on scroll, like developer.mozilla/en/DOM/window.onscroll or help.dottoro./ljurkcpe.php etc. You are limited to what events the browser sends down to Javascript for anything the browser controls. Or you build your own scrollbar and don't use the system one - example: Yahoo Mail, they don't use browser scrollbars for scrolling through the list of emails. – Mörre Commented Jun 20, 2012 at 9:37
1 Answer
Reset to default 7it was a simple solution
Y.on('scroll', function(e) {
console.log(window.scrollY);
});