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
Use the Search Feature. Maybe there is already a solution to your issue.
1. Update Lay Theme and all Lay Theme Addons
2. Disable all Plugins
3. Go to Lay Options → Custom CSS & HTML, click "Turn Off All Custom Code ", click "Save Changes"
4. Now see if your problem solved itself
5. Go here, see if your problem is listed here:
Troubleshooting
When you post:
1. Post a link to where the problem is
2. If the problem is difficult to explain, post screenshots / link to a video to explain it