How to Horizontal Scroll when scrolling vertical?

2020-03-07 04:40发布

So I have been trying for hours. Any tips or ideas on how to make a webpage scroll horizontal instead of scrolling down?

Edit: When someone scrolls vertically, instead of scrolling vertically you scroll Horizontally.

1条回答
够拽才男人
2楼-- · 2020-03-07 05:26

Here is what you need:

Example: http://css-tricks.com/examples/HorzScrolling/

Code: http://css-tricks.com/snippets/jquery/horz-scroll-with-mouse-wheel/

$(function() {
  $("body").mousewheel(function(event, delta) {
  this.scrollLeft -= (delta * 30);
  event.preventDefault();
  });
})

<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>

One More Example: http://jsfiddle.net/ye259/4/

查看更多
登录 后发表回答