Open rredfearn32 opened 7 years ago
which required me to enable the scrollOverflow for FullpageJS.
Your jsfiddle doesn't use scorllOverflow and I'm not able to reproduce the issue in the desktop version of Chrome. The overlay appears as expected and I'm able to scroll down and up again.
Working well in iPhone on Chrome too.
Sorry, I got the wrong jsfiddle link. Here's the correct one: https://jsfiddle.net/rredfearn32/phcwa63w/56/
How about now?
How about now?
Yeah now its ok.
You change opacity:0
to display:none
. It works ok to me when using opacity;0
.
.overlay.ghost
{
opacity: 0;
}
Ah, but I can't use opacity:0 to hide the overlay because that blocks hover/click/touch events on the video. I need to use display: none to hide it.
fullPage.js adds the parameter enablejsapi=1
tp all youtube videos.
That might be the issue?
Try removing it as you are using the api file instead.
Okay, I'll give that a go.. :)
@rredfearn32 let me know if you find a solution.
Sadly, removing that parameter had no effect. I've done a workaround, which involves maintaining the overlay continuously, and then registering clicks to that to pause/play the video. This means the YouTube video controls aren't available anymore, but you can now scroll away from the video okay.
Thanks for helping, and if anyone finds a proper solution (without fully obstructing the player) please post here :)
Description
This is a messy one with several issues...
I have a YouTube iFrame (managed by the YouTube JS API) in a Fullpage JS section. The video has been stretched to fill the entire section (height & width 100%). Some content in the other sections may be longer than the section height, which required me to enable the scrollOverflow for FullpageJS.
With the above set-up, I was not able to scroll away from the YouTube section, as the iframe seemed to be capturing the scroll event. So I created an 'overlay' div to cover the video and act as a 'surface' to scroll on.
The overlay div starts out displayed (in the JSFiddle below, I've coloured it red to better see it), then when you click it, it's hidden and the video starts playing. When the video is paused or ends, I want the overlay to reappear. I detect this with YouTube's onStateChange event listener. See line 11 of JSFiddle.
Now, the following error only happens on mobile platforms or in JSFiddle. On regular desktop (Chrome, Firefox, IE, etc) it behaves fine. But...
Something in Fullpage seems to be interfering with YouTube's onStateChange event listener and stops it from firing. This means the overlay cannot be re-applied and you're left stranded on the video slide. It's definitely Fullpage, because if you remove the call to Fullpage on line 23 of JSFiddle, the event listener works fine and the overlay behaves as expected. Also, strangely, YouTube's onReady event listener fires just fine. Hmm..
So:
1.) Anyone else come across this issue / a solution to it? 2.) Am I going the right way about tackling the underlying "scroll even captured by iframe" problem with an overlay, or has anyone else found a better solution?
Link to isolated reproduction with no external CSS / JS
Reproduction of environment: https://jsfiddle.net/rredfearn32/phcwa63w/56/
Site of original error: http://dev.oxplore.surge.online/question-detail/602
Steps to reproduce it
Versions
Mobile Chrome on Android devices, JSFiddle