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

Wrong behaviour after page resize #38

Closed
decadence opened this issue Dec 5, 2014 · 4 comments
Closed

Wrong behaviour after page resize #38

decadence opened this issue Dec 5, 2014 · 4 comments

Comments

@decadence
Copy link

Hello.
This plugin works great. But I noticed one issue: after I resize page, event handler get wrong params. Element that is now in viewport gets isInView == false, and element that is under the viewport gets isInView == true. That's why "visible" class is removed and element in viewport just disappears.
After page reload with this page size it works ok.

I use this code:

$('div.section').on('inview', function(event, isInView, visiblePartX, visiblePartY) {
        var $this = $(this);

        if (isInView) {
            $this.addClass("visible");
        }
        else{
            $this.removeClass("visible");
        }
    });

Webkit based browsers works fine, problem in Opera 12, latest Firefox and IE.
Also I tried disable media-queries with no luck.

Or I have to rebind event handlers after each resize?

Screenshot - http://s7.hostingkartinok.com/uploads/images/2014/12/2e41d91a3098988412bd5634796e8a33.png

@tiff
Copy link
Member

tiff commented Dec 9, 2014

Hi @decadence, I'm not able to reproduce this. Can you provide a jsfiddle?
You definitely don't have to rebind event handlers after each resize.

@decadence
Copy link
Author

Send link to site on your email.
Thanks for the reply.

@exside
Copy link

exside commented Feb 13, 2015

Have similar problem, when I have Firebug open in Firefox inview always returns false, no matter if en element is inview or not, so elements just do not display/behave as they should which is misleading (e.g. indicating bugs where there are none =D)

@sadikyalcin
Copy link

Replicated on Chrome v 75.0.3770.100 (Official Build) (64-bit). I have a carousel of iframes at 1366 x 768 which is scaled to fit within the viewport via css transform. Resizing the browser triggers on view event even when elements are not in 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

4 participants