Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

No scroll for mobile advanced demo if cursor inside setPin #34

Closed
maubut opened this issue Mar 25, 2014 · 2 comments
Closed

No scroll for mobile advanced demo if cursor inside setPin #34

maubut opened this issue Mar 25, 2014 · 2 comments
Labels

Comments

@maubut
Copy link

maubut commented Mar 25, 2014

hey,

In your example for mobile support, if the cursor is directly on the blue box and we scroll the page.. nothing happens. The cursor need to be outside the blue box while you scroll.

The problem seems to come from the fixed position and the overflow-y of the container. Do you have any solutions ? I need to do similar effect with full width..

http://janpaepke.github.io/ScrollMagic/examples/expert/mobile_advanced.html

@janpaepke janpaepke added the bug label Mar 25, 2014
@janpaepke
Copy link
Owner

Hi!

I never noticed this, because I mostly tried it on mobile. :)
This is a very interesting bug, thanks for bringing it to my attention.
It only occurs DURING the pin on a desktop device, when the cursor is over the pinned element.

It seems the reason is that it no longer regards the element as a child of the parent container but of the body. But in this case we want to scroll the container and not the body.
I played around a little with the css to prevent the body from receiving the event, but so far no luck.

I will create a JS fiddle and post it on stackoverflow.
Maybe somone there has an Idea...

I'll keep ya posted!
regards, Jan

UPDATE:
check the stackoverflow entry here: http://goo.gl/S4bJXc
And the jsfiddle here: http://jsfiddle.net/LwY2j/4/

@janpaepke
Copy link
Owner

Soooo this was fast! (stackoverflow rules)

The easiest way is using this css for the fixed element:

#fixed {
  pointer-events: none;
}

The problem is, that it is not supported by older browsers:
http://caniuse.com/#search=pointer-events

A complete workaround requires javascript and I have tested this and it seems to work:

$('#fixed').on('mousewheel DOMMouseScroll', function(event) {
    $('#content').scrollTop($('#content').scrollTop() - (event.originalEvent.wheelDelta ||  event.originalEvent.detail*30));
});

See here for more details: http://stackoverflow.com/questions/13494850/a-way-to-scroll-an-underlying-div-when-mouse-is-on-top-of-a-fixed-div?answertab=votes#tab-top

I will add the pointer events css to the examples. :)

regards,
J

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants