Javascript change mouse up down to left right [closed]
Questions asking for code must demonstrate a minimal understanding of the problem being solved. Include attempted solutions, why they didn't work, and the expected results. See also: Stack Overflow question checklist
Closed 9 years ago.
Improve this question 开发者_开发技巧I want to design a horizontal site, so when I scroll up and down I want the page to go from left to right. Is this possible?
you want to use the browser's scroll bar to do this, or you want to change behavior for the mouse wheel scroll?
for the first case you'd have to fake some of the interface stuff. have a div that takes up the whole window, and make that div as tall as your actual content is wide (approximately, you'll have to tune it). and then your actual conent can be fixed in place, just leaving the lower div's scroll bar visible. then you can watch for a scroll event and adjust your content view accordingly.
the second case isn't too bad- you need to determine what mouse wheel action happened and then do a manual operation to +/- the scrollLef operation for the window. i've seen this done and i hated the site but it was an interesting idea. mouse events aren't very uniform across browsers but i'll assume someone will pop in to tell you how awesome a particular jquery plugin is for that.
This'll be a horrible user experience, but you could do it by monitoring the scoll events in javascript, and adjusting the horizontal scroll appropriately.
精彩评论