mardi 20 septembre 2016

Scroll Detection in Ember JS?

What's the best way to detect scrolling in Ember JS? There is no built in scroll action, and I can use jquery but not sure where to place it? Would it go in my application.js because it has application scope, or elsewhere?

The actual scroll detection/logic is not an issue here, but rather how to set up scripts like this in an Embery way.

Ideally scrolling would be an action, and could be handled as such in the application.js file:

import Ember from 'ember';

export default Ember.Route.extend({
    actions: {
        toggleBurger: function(event) {
            $("#blur-wrapper").toggleClass("blur");
        },
        onScroll: function() {
            alert('scrolled');
        }
    }
});




Aucun commentaire:

Enregistrer un commentaire