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?
-
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!
-
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; }
-
-
-
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
Before you post:
- When using a WordPress Cache plugin, disable it or clear your cache.
- Update Lay Theme and all Lay Theme Addons
- Disable all Plugins
- Go to Lay Options → Custom CSS & HTML, click "Turn Off All Custom Code", click "Save Changes"
This often solves issues you might run into
When you post:
- Post a link to where the problem is
- Does the problem happen on Chrome, Firefox, Safari or iPhone or Android?
- If the problem is difficult to explain, post screenshots / link to a video to explain it