0

How would I detect wether a horizontal scroll bar is at the end.

I have got this far with adding horizontal scrolling shadows: http://codepen.io/hugo/pen/kCveF

but I would like to remove the class ".shadow-middle" and add the class".shadow-left" when the scroll bar gets to the end.

How would I do this?

4

2 回答 2

1

I would try to get the window size when the page loads and then set a scrollLeft() if statement that went something like if scrollLeft equals window width remove shadow middle and add shadow left.

I forked your project on codepen and then wrote the javaScript I was explaining. here is the pen

于 2013-03-29T18:56:55.577 回答
0

You would need to get the width of the container and compare it with the scrollLeft, switching the classes when they are the same on scroll

于 2013-03-29T19:09:16.343 回答