Giter Site home page Giter Site logo

Always returns false about within-viewport HOT 6 CLOSED

patik avatar patik commented on September 4, 2024
Always returns false

from within-viewport.

Comments (6)

patik avatar patik commented on September 4, 2024

Can you try withinviewport(document.getElementById('hello')) ?

If that doesn't work, can you post the code somewhere (preferably a reduced test on Codepen, JSBin, etc) so I can try and debug it?

from within-viewport.

deliver2manish avatar deliver2manish commented on September 4, 2024

I used this plugin and I also face same problem.

console.log(withinviewport(document.getElementsByClassName("quest-grid-image")[i])) always returns false even if the element is visible.

The element id is correct. I double checked it.

from within-viewport.

patik avatar patik commented on September 4, 2024

I can't reproduce the bug in my own demos so I wonder if some other CSS in your page is affecting it. Can you link to the page or put a quick demo in Codepen/JSBin? Are there any iframes involved?

from within-viewport.

deliver2manish avatar deliver2manish commented on September 4, 2024

I use it for this website: http://www.seenit.in. I included the ('js/jquery.withinviewport.js', 'js/withinviewport.js') files and used it as shown below:

$(window).bind("scroll", function() {
    var i;
    for(i=0;i<12;i++){
        console.log(withinviewport(document.getElementsByClassName("quest-grid-image")[i]));
    }
});

It always prints false on the console log, even if the element is fully visible on the screen.

from within-viewport.

patik avatar patik commented on September 4, 2024

This is now fixed with v1.0.0. Thanks for including the example code, @deliver2manish. I believe the issue was that the <div> you were targeting was inside an <a> (i.e. an inline element, rather than a block) and that tripped up the part of my code that calculates the target element's position. I'm using a faster and more robust method now.

from within-viewport.

deliver2manish avatar deliver2manish commented on September 4, 2024

Thanks. It fixes the bug for me.

On Mon, Aug 3, 2015 at 4:19 AM, Craig Patik [email protected]
wrote:

This is now fixed with v1.0.0
https://github.com/patik/within-viewport/releases/tag/1.0.0. Thanks for
including the example code. I believe the issue was that the

you
were targeting was inside an (i.e. an inline element, rather than a
block) and that tripped up the part of my code that calculates the target
element's position. I'm using a faster and more robust method now.


Reply to this email directly or view it on GitHub
#16 (comment)
.

"Stay Hungry, Stay Foolish"

from within-viewport.

Related Issues (16)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.