/ Published in: jQuery
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
1) Load jQuery and the Mouse Wheel plugin Mouse Wheel plugin: (http://plugins.jquery.com/project/mousewheel). <script type='text/javascript' src='http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js?ver=1.3.2'></script> <script type='text/javascript' src='/js/jquery.mousewheel.min.js'></script> 2) Attach mousewheel event to body The "30" represents speed. preventDefault ensures the page won't scroll down. $(function() { $("body").mousewheel(function(event, delta) { this.scrollLeft -= (delta * 30); event.preventDefault(); }); });
URL: http://css-tricks.com/snippets/jquery/horz-scroll-with-mouse-wheel/