Code Monkey home page Code Monkey logo

wheninviewport's People

Contributors

dbrekalo avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

wheninviewport's Issues

How to refire on orientation change / canvas rotate?

Hello there. I just started toying around with this plugin. Please bare with me as I am just getting into javascript. I notice that when I do canvas orientation change that many times the wheninview events do not fire.

I'm using this code from the example project which works perfect except when I rotate canvas on a mobile device.

;
$(function() {
    var WhenInViewport = window.WhenInViewport;

    $('.brick').whenInViewport(function($brick) {
        $brick.addClass('animate');
    });
});

Scroll handlers being removed after being called once?

Hi there,

I'm working on an infinite scroller using this library, where more content is loaded once you scroll to the bottom. Great library, btw, it works perfectly on both desktop and phone, and was painless to setup.

But, I'm noticing an issue where my scroll handler is called once on first being created, then once when you actually scroll to the bottom, but then it never gets called again and more content isn't loaded.

I dug through the code, and in node_modules/when-in-viewport/src/whenInViewport.js, commenting out the following function:


removeItem: function(registryItem) {

            delete this.store[registryItem.storeKey];

        },

fixed the issue. So it looks like each time when the callback is triggered, the event itself is removed from the registry so it isn't triggered again.

Any ideas why this is? I'm happy to submit a pull with a fix if needed.

I installed using npm install as per your documentation, and I'm using this in a vue-js project, via:


import WhenInViewPort from 'when-in-viewport'
this.viewPortHandler = new WhenInViewPort(this.$el, this.handleScroll)

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.