Reputation: 81
Here is a simple test case for my problem :
How to make the parent div normally scroll with mouse wheel, even when the mouse is over the position: fixed element ?
Thanks.
Upvotes: 8
Views: 3711
Reputation: 191
The pointer-events: none
seems to work as long as you don't need any event in the fixed div
If you need events on it I found 2 solutions:
position: sticky
instead so the scroll event bubbling happens normally but you'll have to work on the CSS because sticky doesn't exactly do the same as fixedUpvotes: 0
Reputation: 4886
Its very late for an answer but I was able to overcome this problem by adding pointer-events: none
style to the "fixed" div.
Like this: http://jsfiddle.net/JZmvf/55/
Upvotes: 5
Reputation: 5205
Elements with position: fixed;
are positioned relative to the viewport, so the scrollable
div is not the parent of the fixed
div in this case, even though it may appear that way if you're just looking at the output.
If you position your cursor over the fixed
div and scroll down, your browser is being told to scroll down the fixed
div. Fixed elements, by nature, are not scrollable, so nothing happens.
You may want to add a few more details about exactly what you're trying to accomplish. Hope that helps!
Upvotes: 1