Coder Social home page Coder Social logo

Comments (12)

hhff avatar hhff commented on September 21, 2024

Inneresting. I think catering for every use case is outside of the scope of this library. However I think maybe we should make this hook public, so that people who want to control how this check works can easily override it.

@daniel-de-wit would u be down to submit a PR to make this public, and document your use case in the README?

from ember-infinity.

daniel-de-wit avatar daniel-de-wit commented on September 21, 2024

Thanks for your reply, I was on vacation so didn't see your message..

I believe there must be a proper way we can detect if the component is on screen. There are some jQuery plugins that work with nested scrollable divs, I think. Maybe I can extract a good solution for every use case since we just want it to fire when visible to the user on screen.

I definitely like your idea of making the hook public.

It might take me a little while to fix this as I have never actually commited something to an open-source project. But I will try to do it :)

Thanks again for making this wonderfull addon 👍

from ember-infinity.

hhff avatar hhff commented on September 21, 2024

I wonder if we can use this somehow?
https://github.com/poteto/ember-in-viewport-demo

On Tue, 1 Sep 2015 at 15:50 Daniel de Wit [email protected] wrote:

Thanks for your reply, I was on vacation so didn't see your message..

I believe there must be a proper way we can detect if the component is on
screen. There are some jQuery plugins that work with nested scrollable
divs, I think. Maybe I can extract a good solution for every use case since
we just want it to fire when visible to the user on screen.

I definitely like your idea of making the hook public.

It might take me a little while to fix this as I have never actually
commited something to an open-source project. But I will try to do it :)

Thanks again for making this wonderfull addon [image: 👍]


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

from ember-infinity.

hhff avatar hhff commented on September 21, 2024

Sorry i mean this: https://github.com/dockyard/ember-in-viewport

from ember-infinity.

hhff avatar hhff commented on September 21, 2024

Yeah! We totally can...

wanna have a go at it? I can help with the OSS stuff 👍

from ember-infinity.

daniel-de-wit avatar daniel-de-wit commented on September 21, 2024

Yes sounds like a fun challenge ;)

I wonder if the ember-in-viewport supports nested scrollable divs. I'll go fiddle with it.
I'll keep you posted.

from ember-infinity.

hhff avatar hhff commented on September 21, 2024

awesome @daniel-de-wit !!!

from ember-infinity.

 avatar commented on September 21, 2024

from ember-infinity.

hhff avatar hhff commented on September 21, 2024

pretty sure ember-in-viewport supports offsets out of the box 👍

from ember-infinity.

hhff avatar hhff commented on September 21, 2024

jah it does

export default Ember.Component.extend(InViewportMixin, {
  viewportOptionsOverride: Ember.on('didInsertElement', function() {
    Ember.setProperties(this, {
      viewportUseRAF            : true,
      viewportSpy               : false,
      viewportScrollSensitivity : 1,
      viewportRefreshRate       : 150,
      viewportTolerance: {
        top    : 50,
        bottom : 50,
        left   : 20,
        right  : 20
      }
    });
  })
});

from ember-infinity.

 avatar commented on September 21, 2024

Cool :).

2015-09-01 16:16 GMT+02:00 Hugh Francis [email protected]:

jah it does

export default Ember.Component.extend(InViewportMixin, {
viewportOptionsOverride: Ember.on('didInsertElement', function() {
Ember.setProperties(this, {
viewportUseRAF : true,
viewportSpy : false,
viewportScrollSensitivity : 1,
viewportRefreshRate : 150,
viewportTolerance: {
top : 50,
bottom : 50,
left : 20,
right : 20
}
});
})
});


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

from ember-infinity.

andrewhavens avatar andrewhavens commented on September 21, 2024

I also was having an issue where the loading component was not triggering the loadMoreAction when it came into view. I also tried the InViewportMixin and it worked for me! Here is the code that I used to achieve the results that I needed (note that I start loading 1500px before the loader comes into the viewport):

import Ember from 'ember';
import InfinityLoaderComponent from 'ember-infinity/components/infinity-loader';
import InViewportMixin from 'ember-in-viewport';

export default InfinityLoaderComponent.extend(InViewportMixin, {
  viewportOptionsOverride: Ember.on('didInsertElement', function() {
    Ember.setProperties(this, {
      viewportSpy: true,
      viewportTolerance: {
        bottom: 1500,
      }
    });
  }),

  didEnterViewport() {
    this.sendAction('loadMoreAction')
  },

});

from ember-infinity.

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.