Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Because I think this topic is interesting I tried a little around. I figured the easiest way is to do it without the plugin. This is my resulting code to make the page scroll horizontal:</p> <pre><code>// set a block variable if we are over another element that scrolls // if ie would support e.target for scrolling this wouldn't be needed var blockScroll = false; $(".scroller").on("mouseenter mouseleave", function (e) { blockScroll = e.type === "mouseenter"; }) function scrollFunc (e) { // stop if the target is a .scroller and also // if there is an indication that a vertical scroll was done if (blockScroll || ("wheelDeltaX" in e &amp;&amp; e.wheelDeltaX != 0) || e.shiftKey) return; // prevent default scrolling (no jumps) e.preventDefault(); // get ammount of scrolling var scroll = "wheelDelta" in e ? -e.wheelDelta : (e.detail * 2); // use scroll y for scroll x window.scrollBy( scroll, 0 ); } // try attaching the method like the borwser needs it // this event isn't covered by jquery so I had to do it manually if (document.addEventListener) { // W3C sort of document.addEventListener( "DOMMouseScroll", scrollFunc, false ); document.addEventListener( "mousewheel", scrollFunc, false ); } else if (document.attachEvent) { // IE way document.attachEvent("onmousewheel", scrollFunc); } else { document.onmousewheel = scrollFunc; } </code></pre> <p>Note: that every element that scrolls on it's own has to have the class <code>scroller</code> with this code. If needed you could try to get the <code>overflow</code> value with jquerys <code>css</code> but I wouldn't recommend that.</p> <p><a href="http://jsfiddle.net/2ntAP/13/" rel="nofollow">This is my result</a>! But I have to say that I have no mobile devices to test it there. This solution will only work for mouse wheels.</p> <p>If you have another element that should scroll horizontal replace the <code>document</code> in my example with your element node and <code>window.scrollBy</code> with <code>element.scrollLeft += -scroll</code>.</p> <p>I also might have to add that the scrolling will never be as smooth as done directly.</p> <p>EDIT: I have another idea how this could be accomplished. You could make the page scroll vertical and put a div in it with 100% size and fixed position. Then use the onscroll event to synchronize the horizontal scroll of the inner div with the vertical scroll of the body. I have no idea how well that'll work though.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload