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

Custom class for juvia container loading and loaded #23

Open
JangoSteve opened this issue Feb 5, 2013 · 2 comments
Open

Custom class for juvia container loading and loaded #23

JangoSteve opened this issue Feb 5, 2013 · 2 comments

Comments

@JangoSteve
Copy link
Collaborator

This is along the same lines as #22, but toward a different purpose. Let's say I have a div where juvia loads the comments, which I specify in the juvia options.container property:

<div id="juvia-comments"></div>

It'd be nice if juvia added a juvia-loading class to that container when the ajax request starts and then change it to a juvia-loaded class when the comments have loaded. Separate from firing a javascript event as in #22, this would allow me to do something like this.

<div id="juvia-comments">
  <span id="juvia-loading-msg">Comments are loading...</span>
  <span id="juvia-javascript-msg">JavaScript must be enabled for comments.</span>
</div>

Then in my CSS:

#juvia-loading-msg {
  display: none;
}

.juvia-loading #juvia-loading-msg {
  display: block;
}
.juvia-loading #juvia-javascript-msg {
  display: none;
}

.juvia-loaded #juvia-loading-msg,
.juvia-loaded #juvia-javascript-msg {
  display: none;
}

And of course, I could apply other styles too like making the juvia comment section appear differently before and after comments load. And no javascript needed.

@JangoSteve
Copy link
Collaborator Author

By the way, of course, I can already do this trivial example as-is, since juvia will simply replace everything inside the container once it's loaded (and I could nest the js message inside a noscript tag).

But the class stuff would still allow other styling tweaks and whatnot based on the state of the comments having loaded or not.

@FooBarWidget
Copy link
Member

Adding class names is fine. The Javascript message should definitely be inside noscript.

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