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

Data attribute "data-sr" approach has been removed? #207

Closed
MoradHamdy opened this issue Dec 27, 2015 · 2 comments
Closed

Data attribute "data-sr" approach has been removed? #207

MoradHamdy opened this issue Dec 27, 2015 · 2 comments

Comments

@MoradHamdy
Copy link

Hi there,

I don't know if the approach of using "data-sr" data attribute with HTML elements is still supported or not such as this:

data-sr="enter top move 40px over 0.4s wait 0.2s"

@jlmakes
Copy link
Owner

jlmakes commented Dec 28, 2015

You’ve caught the biggest change to ScrollReveal since its release @MoradHamdy!

The simplicity and ease of the data-sr API is what many have come to love about ScrollReveal, which is what made it such a difficult choice to remove.

Some products are meant to be outgrown, but one of my goals is for ScrollReveal to grow with the industry and the developers that use it. This also means I need to take a hard look at things to remove as it grows, to keep things simple and focused.

When I developed the 3.0 release candidate, I supported both the data-sr API and the new JavaScript API—but it wasn’t until I began writing the documentation that I really noticed the confusion of having both strategies.

It’s a bold and critically breaking change, but the JavaScript API truly is a cleaner and more flexible strategy. I’ll admit it's a little less beginner friendly, but I think it's simple and documented well enough to help those beginners grow—after all, inline styles are easy too… but writing and maintaining clean stylesheets is accepted as a better practice, and I think 3.0 follows suit.

I welcome your feedback, especially on how I might help users longtime users who are looking at 3.0 and asking this same question. 🙇

Duplicate #194 #205

@tforssander
Copy link

tforssander commented Dec 29, 2015

Thanks for the info. I decided to keep my data-sr attributes (without any value though) since I usually use data attributes when working with selectors instead of classes.

window.sr = new ScrollReveal();
sr.reveal('[data-sr]');

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

3 participants