question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Direct all scrolling to the x-axis

See original GitHub issue

Not an issue, just a question. 😃

Version 8.0.0

Great library!

What i’m trying to do: I have a horizontal scrolling container. I want to direct all scrolling to the x-axis. So if you use the scroll wheel ( up - down ) it will scroll left-right. Also when you scroll left-right ( trackpad etc ) it will use default scroll left-right.

The start would be to use the “invertDelta” plugin to convert the axis. This already works great, when im scrolling up and down it scrolls the container left to right. But how to I combine this with the normal left to right behaviour?

Like this example: buildinamsterdam.com

The only way I thought of to get it to work ( solution could be very wrong ) is to check if if the direction is horizontal / verical in the invertDeltaPlugin: if (delta.x !== 0) { console.log("horizontal"); } else { console.log("vertical"); }

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:8 (4 by maintainers)

github_iconTop GitHub Comments

6reactions
idiotWucommented, Jan 30, 2019

user scrolls to the side with trackpad ( we get x-value and y=0, dont invert delta )

An important point is that we are likely to get both deltaX and deltaY while using trackpads (even you don’t intend to), so y = 0 barely happens.

Personally, I prefer using the norm of vector (x, y) (as commented above).

Edit: the first solution behaves better in the demo 🙃 https://codepen.io/idiotWu/pen/KJNYye?editors=0010

2reactions
nikandlvcommented, Jul 29, 2019

I think this should be implemented as a plugin or a feature. it has a lot of use-cases

Read more comments on GitHub >

github_iconTop Results From Across the Web

Only have scrolling on X axis - Stack Overflow
It only to scroll on the X-axis, it cannot jump down a line then scroll. Here is what i tried: Making the Y-hidden...
Read more >
How to have a Fixed Scrolling Time-Range on the XAxis that ...
It's very simple. After updating the data, you calculate the XAxis.VisibleRange you want to show, and show it. If the user scrolls back...
Read more >
How to scroll MS Chart in X axis? - MSDN - Microsoft
To enable the cursor in the data view, set the IsUserEnabled property to True. To enable data view selection, set the IsUserSelectionEnabled ...
Read more >
Scrolling through a Graph or Chart - NI - National Instruments
Right-click a graph or chart and select Visible Items»X Scrollbar from the shortcut menu to display a scroll bar below the graph or...
Read more >
Practical CSS Scroll Snapping
To make a horizontal slider, we tell the container to snap along its x-axis. We're also using scroll-padding to make sure the child...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found