Lay Theme Forum

    • Register
    • Login
    • Search
    • Recent
    • Tags
    • Popular
    • Users
    • Search

    Add page loaded flag

    Feedback
    3
    11
    722
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • E
      ernestobellei last edited by

      Hi,

      It would be useful to have a flag (es a class / meta 'is-loaded') when ajax / DOM loading ends.

      Thanks you,
      Ernesto

      1 Reply Last reply Reply Quote 0
      • mariusjopen
        mariusjopen Global Moderator last edited by

        Dear @ernestobellei

        sure. I will check with Armin about that.

        Best!

        Marius

        www.mariusjopen.world

        1 Reply Last reply Reply Quote 0
        • arminunruh
          arminunruh Global Moderator last edited by

          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?

          E 1 Reply Last reply Reply Quote 2
          • E
            ernestobellei @arminunruh last edited by ernestobellei

            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

            1 Reply Last reply Reply Quote 0
            • arminunruh
              arminunruh Global Moderator last edited by

              Sure, good point!

              E 1 Reply Last reply Reply Quote 2
              • E
                ernestobellei @arminunruh last edited by

                Hi @arminunruh and @mariusjopen,

                Any chance to have this class implemented?
                p.s. thanks for the shortcode fix :))

                Best,
                Ernesto

                1 Reply Last reply Reply Quote 0
                • mariusjopen
                  mariusjopen Global Moderator last edited by

                  Hi @ernestobellei
                  I will check back with Armin.

                  Best!

                  Marius

                  www.mariusjopen.world

                  1 Reply Last reply Reply Quote 0
                  • arminunruh
                    arminunruh Global Moderator last edited by

                    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;
                    }
                    
                    E 1 Reply Last reply Reply Quote 0
                    • E
                      ernestobellei @arminunruh last edited by

                      Hi @arminunruh ,

                      I don't understand your answer :))
                      Is it about the loaded class?

                      Best,
                      Ernesto

                      1 Reply Last reply Reply Quote 0
                      • mariusjopen
                        mariusjopen Global Moderator last edited by

                        Hi @ernestobellei
                        I will check back with Armin.

                        Best!

                        Marius

                        www.mariusjopen.world

                        1 Reply Last reply Reply Quote 0
                        • arminunruh
                          arminunruh Global Moderator last edited by

                          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

                          1 Reply Last reply Reply Quote 0
                          • First post
                            Last post

                          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

                          Thanks!

                          Online Users

                          B
                          A
                          A
                          7
                          N
                          J
                          S
                          M
                          P

                          Recent Topics

                          • A

                            Theme crashed - because of Polylang?

                          • A

                            can't change front page

                          • M

                            komische boxen auf der Website

                          laytheme.com