Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

New data-scroll syntax #3

Closed
terwanerik opened this issue Jul 3, 2016 · 2 comments
Closed

New data-scroll syntax #3

terwanerik opened this issue Jul 3, 2016 · 2 comments

Comments

@terwanerik
Copy link
Owner

There is something i do not like about the strictly positioned parameters, they feel a bit old-school and sluggish, and way to strict. I would like a looser approach.

I was thinking about this yesterday, what do you guys think? Instead of having the scroll offset as the first parameter, being ambiguous and all, like so:
<div data-scroll="150 animateIn animateOut once"></div>

How about something more clear, like so:
<div data-scroll="animateIn animateOut offset(0,150) once"></div>

That way it is not strict to the first parameter, and we can use it for x as well as the y position. So now the only 2 strictly positioned parameters are the animateIn and animateOut classes. We can also eliminate those with something like this:
<div data-scroll="in(.animateIn) out(.animateOut) offset(0,150) once addHeight"></div>

That way the code is way more legible, adding the dot before the animateIn and animateOut classes hints the user that its a CSS class.

Another approach would be to use a single parameter for the animateIn and out classes, like so:
<div data-scroll="toggle(.animateIn, .animateOut) offset(0,150) once addHeight"></div>

What would you guys prefer?

@skttl
Copy link

skttl commented Jul 3, 2016

I would prefer <div data-scroll-in="animateIn" data-scroll-out="animateOut" data-scroll-offset="0,150" data-scroll-once></div>

Could then be extended with data-scroll-in-callback, data-scroll-out-callback etc.

Not sure what the addHeight is for :)

@terwanerik
Copy link
Owner Author

Alright, yeah for v0.2 i have chosen for data-scroll-showCallback and data-scroll-hideCallback. The callback needs to be in the global window scope, it avoids using eval.

The syntax i've chosen for v0.2 is the last one i mentioned in the post, using toggle() and offset() to pass those parameters.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants