Code Monkey home page Code Monkey logo

Comments (5)

ryanburnette avatar ryanburnette commented on September 18, 2024

For now I'm just manually checking to see if the viewport is scrolled past the element. It's a simple situation being that the element in question occupies the very top of the body. I'd love to know a better approach for future situations though.

$(window).on('load', function () {
  if ( $(window).scrollTop() > $header.height() ) {
    activate();
  }
});

from jquery.inview.

andypillip avatar andypillip commented on September 18, 2024

I second this.

A nice way would also be if the actual code to check if an element is in view would be populated, so one could use it from outside the event.

from jquery.inview.

andypillip avatar andypillip commented on September 18, 2024

Btw ryan, when you trigger the event manually the whole inview-logic is bypassed – hence you need to pass the inview parameter yourself.

Since you don't pass anything, your first condition will never be satisfied, and activate() will be called.

from jquery.inview.

andypillip avatar andypillip commented on September 18, 2024

@ryanburnette I just commited a pull request that fixes this issue: 1e4bf03

Actually the inview event should be fired initially as well, but due to a mistake in code only for elements that are or have been in view.

from jquery.inview.

LeisureLarry avatar LeisureLarry commented on September 18, 2024

@andypillip Thanks for the solution. Manually patching the code, fixed the problem for me.

from jquery.inview.

Related Issues (20)

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.