http://www.dyn-web.com/code/scroll/documentation.php
Dw_scroll is a javascript snippet which has various functionality to scroll an element with showing the browsers default scroll bar. it has functionality like detecting mouse wheel ...
when i used this the page will not scroll and that is the default action for all elements if there is content to scroll. i mean that when the focus is in an element which has overflowed content then using the mouse wheel will not scroll the window it will just scrolls that element... sorry, you already know this.
but the most important point is that when you use flash products which does some animation in the site... it supresses the mouse wheel scroll and the focus is always to the flash object.... if you scroll anywhere on the page it wont scroll the window instead the flash will get the wheel events...
so i used the following code... to override it... (basically i do not know much about object tags focus and wheel events especially flash... may be that is the way it would have been coded)...
i dont want to manipulate dwscroll instead i was trying for a new script which will scroll the window irrespective of the current focus...
then i used jquery scrollTop option which comes with the animate effect....
and now it is working.
the code is...
Code:
var nou=0;
$('html,body').mousewheel(function(event, delta) {
if (delta > 0)
{
nou = $('html, body').scrollTop()
nou-=50
$('html, body').animate({scrollTop: nou}, 0);
}
else if (delta < 0)
{
nou = $('html, body').scrollTop()
nou+=50
$('html, body').animate({scrollTop: nou}, 0);
}
});
i dont want the animation so i made the animation duration to zero and as espected it works like the normal window scroll...
but... i hope the scroll is triggered twice... by the default scroll event and by this jquery scroller.... though that could be the case ain't much difference...
if you have any other more robust or effective standard alternate then please you can consider dropping that here...
Bookmarks