Add page loaded flag
-
Hi,
It would be useful to have a flag (es a class / meta 'is-loaded') when ajax / DOM loading ends.
Thanks you,
Ernesto -
-
You mean a html class that is added?
Maybe the body gets a html class: loading, loaded
Do you want to style your website according to loading?
-
You mean a html class that is added?
Maybe the body gets a html class: loading, loaded
Do you want to style your website according to loading?
Hi, @arminunruh
Sorry for the delayed answer but I missed the notification :))
I wrote a marquee shortcode for WordPress and I would like to init it as soon as the DOM is loaded (even using Ajax). By now I’m using a mutation observer that listens on DOM add/change events and detect whether the shortcode HTML has been loaded, but checking for a class would be a lighter and cleaner solution.
Having a .loaded class (or data-attribute) would be useful to avoid double check for mobile and desktop layout gridder too.
Best,
Ernesto -
Sure, good point!
-
Sure, good point!
Hi @arminunruh and @mariusjopen,
Any chance to have this class implemented?
p.s. thanks for the shortcode fix :))Best,
Ernesto -
-
Maybe because #grid has overflow:hidden; and that is why it doesn't work.
http://dinbror.dk/blog/help-css-position-sticky-doesnt-work-solved/
in your custom css write:
#grid{ overflow: auto; } -
Maybe because #grid has overflow:hidden; and that is why it doesn't work.
http://dinbror.dk/blog/help-css-position-sticky-doesnt-work-solved/
in your custom css write:
#grid{ overflow: auto; } -
-
Whoops,
Sorry.
I think you are looking for something like:
<script> window.addEventListener('popstate', function(){ jQuery('body').removeClass('page-loaded'); }); window.laytheme.on('newpageshown', function(){ jQuery('body').addClass('page-loaded'); }); </script>Add this to lay options -> Custom <head> content
Hello! It looks like you're interested in this conversation, but you don't have an account yet.
Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.
With your input, this post could be even better 💗
Register Login