rwjblue / ember-waypoints

Ember CLI Addon for using jQuery-Waypoints
MIT License
35 stars 8 forks source link

Please consider adding examples on how to use #5

Closed janwerkhoven closed 9 years ago

janwerkhoven commented 9 years ago

Hi,

Great to see someone integrated Waypoints into Ember!

I have used Waypoints before a lot, but never within an Ember environment. I am not succeeding in making your code work... Perhaps I don't have enough experience, but could you add code examples to the documentation? You showed how the template wrapper looks like. How would it look like in the controller and/or view? You talk about options, where do I add them?

Kind regards,

Jan

habdelra commented 9 years ago

I added a couple samples in the readme in PR https://github.com/rwjblue/ember-waypoints/pull/6

The idea is that the addon should allow you to not have to worry about adjusting your controller or view. You are really only updating your templates to use this. The only impact to your controller (or other components that use this add-on) would be updating them to receive whatever actions you configure to be fired with the on-up or on-down actions.

janwerkhoven commented 9 years ago

Great, that helps.

So the on-up="action" basically fires an action the views / controllers above, got it.

Does the offset also accept percentages? If offset="50" triggers 50px below the top of your containing scrolling container, does offset="100%" trigger on the bottom of that container?

And lastly, I assume the options are used as below? continous=true triggerOnce=true horizontal=true

Keep it up! Love this integration as I am using Waypoints a lot and just started with Ember CLI.

habdelra commented 9 years ago

So the best way to think about this addon is as a wrapper that forwards the options to jquery-waypoints and binds to all the events emitted from jquery-waypoints. So if jquery-waypoints accepts percentages for an offset, then the {{waypoint}} template helper should too (I honestly don't know if waypoints takes a percentage, but you should be able to look that up in the waypoints docs: http://imakewebthings.com/waypoints/)

And lastly, I assume the options are used as below? continous=true triggerOnce=true horizontal=true

Correct, these are supported, and would work as you have them here.