nckprsn / scrollme

A jQuery plugin for adding simple scrolling effects to web pages.
1.47k stars 319 forks source link

Not working with AngularJS #29

Open konpa opened 8 years ago

konpa commented 8 years ago

Hello,

I'm trying to get scrollme to work with AngularJS but without luck for now. No event is triggered even if the scollme component is loaded (tested with console.log()). No error in the console.

Is anyone ever used scrollme with AngularJS? Any advice on this?

Thanks in advance.

simonh1000 commented 8 years ago

I am having the same issue. With another jquery plugin I used a directive to run the 'init' function after the angular component had loaded, but can't work out what the parallel would be in this case

sheriffderek commented 8 years ago

I'm guessing that scrollme figures out the heights of it's scrollme sections / and that it's doing it before your app is built. Try running it in the ready: function({}), hook in your app.js - or running it after the dom is built in each directive or view template render hook - whatever that may be, for angular.

newkolay commented 8 years ago

I had the same issue, the solution that worked for me: 1.Inside the directive use jQuery function $.getScript to load scrollme.js asynchronously

  1. Find in scrollme.js this line $document.on( _this.init_events.join( ' ' ) , function(){ _this.init(); } ); and replace it with _this.init();
resao commented 7 years ago

@kolya3001 This did the trick for me, thank you!

resao commented 7 years ago

@kolya3001 In fact I didn't even need to asynchronously load the scrollme.js, simply changing the line in your second point was enough