Forums

The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums CSS How to horizontally scroll by mouse wheel

  • This topic is empty.
Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #286276
    Shofol
    Participant

    Hi, I want a horizontally scrolling website and find a solution using Flexbox. The scroll and divs are showing as I want.
    But, the problem is- I can’t scroll by mouse wheel. Is there any way to do that using CSS or do I need to use JS for that?

    Codepen Link: https://codepen.io/AnowerJahan/pen/rbwjxq

    #286286
    Dagny
    Participant

    You need JS for that. Here is a tutorial https://css-tricks.com/snippets/jquery/horz-scroll-with-mouse-wheel/

    Their JS link has expired, here is another one – https://github.com/jquery/jquery-mousewheel (would be better to find a recent version)

    #286305
    Shikkediel
    Participant

    The vanilla wheel event has good support by now, so jQuery would not even be needed…

    codepen.io/anon/pen/rbzMwN

    #286308
    Shofol
    Participant

    Excellent Solutions. Thank you very much to both of you. And, Shikkediel, thanks for the demonstration :)

    #298703
    Marvin El Marziano
    Participant

    @Shikkediel That Codepen doesn’t seem to work on my MacOS Safari? No problem Firefox+Chrome. I can’t figure out why at the moment, but it seems to try to vertically scroll. Adding “overflow-y: hidden;” to the CSS for the “body”-element hides the vertical scrollbar but doesn’t start scrolling. I tried to add “e.preventdefault()” to override the vertical scroll but no cigar.

Viewing 5 posts - 1 through 5 (of 5 total)
  • The forum ‘CSS’ is closed to new topics and replies.