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

What about wow when JS fails? #27

Open
jgugelot opened this issue Sep 23, 2019 · 2 comments
Open

What about wow when JS fails? #27

jgugelot opened this issue Sep 23, 2019 · 2 comments

Comments

@jgugelot
Copy link

jgugelot commented Sep 23, 2019

To prevent elements from 1st showing, then disappearing and then appearing again (animation) when using wow, I added the CSs line: .wow { visibility:none;}

However, this causes elements to stay hidden when JS fails or disabled in browser. For that, I created this little / script function:

<!-- wow backup -->
<noscript><style>.wow {visibility: initial;}</style></noscript>
<script>window.onload=function(){elem = document.querySelector('.wow');style = getComputedStyle(elem);if (style.visibility=='hidden') {style = document.createElement('style');document.head.appendChild(style);style.sheet.insertRule('.wow { visibility:initial;}');}}</script>
@hidegh
Copy link

hidegh commented Dec 13, 2022

Trying to solve similar issue with AOS.js (actually dopping the use of it).

We need an wow-initialized class. Actually we can request this feature, but until then I'd suggest this solution:

  • WOW.init()
  • and then, if the code above does not break, just use document.querySelectorAll(".wow") to append a ".wow-initialized" class to all animated container
  • and then just use CSS: .wow { visibility: visible; /ev. opacity might be required/ } and .wow.wow-initialized: { visibilty: none; }

@hidegh
Copy link

hidegh commented Dec 13, 2022

FEATURE REQUEST: ❗we require a new option: initializedClassName that should be set to all .wow containers and to all newly detected containers. In reg. to this feature, we should also alter the CSS of the .wow - only .wow.wow-initialized should have the visibility: hidden set.

In case WOW.js load fails, this class then would not be appended, which would result in the element still being shown as intended in case no animation would be added.

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

No branches or pull requests

2 participants