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

Making This Work in an iFrame #73

Open
brittonk opened this issue Aug 3, 2018 · 1 comment
Open

Making This Work in an iFrame #73

brittonk opened this issue Aug 3, 2018 · 1 comment

Comments

@brittonk
Copy link

brittonk commented Aug 3, 2018

I'm working on an app which this script works great on. Unfortunately, I've had to enclose everything in an iframe so that I can keep user uploads (photos/videos) continuing across page change in the app.

When inside the iframe, inview no longer works. Would there be an easy fix to get it to watch the iframe's content viewport?

@sadikyalcin
Copy link

sadikyalcin commented Feb 26, 2019

You can try this. Not sure if it will work as first time I'm using this library now and trying it out.

var iframe = $('iframe');
var yourElement = $(iframe).contents().find('.yourelement');

$(yourElement).on('inview', function(event, isInView) {
    if (isInView) {
        // in-view
    } else {
        // off-view
    }
});

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

No branches or pull requests

2 participants