Skip to content
  • Recent
  • Tags
  • Popular
  • Users
  • Search
Skins
  • Light
  • Brite
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse

Lay Theme Forum

  1. Home
  2. Feedback
  3. Add page loaded flag

Add page loaded flag

Scheduled Pinned Locked Moved Feedback
11 Posts 3 Posters 2.1k Views 1 Watching
  • 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
    E
    ernestobellei
    wrote on last edited by
    #1

    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
    0
    • mariusjopenM
      mariusjopenM
      mariusjopen
      Global Moderator
      wrote on last edited by
      #2

      Dear @ernestobellei

      sure. I will check with Armin about that.

      Best!

      Marius

      www.mariusjopen.world

      1 Reply Last reply
      0
      • arminunruhA
        arminunruhA
        arminunruh
        Global Moderator
        wrote on last edited by
        #3

        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
        2
        • arminunruhA arminunruh

          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
          E
          ernestobellei
          wrote on last edited by ernestobellei
          #4

          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
          0
          • arminunruhA
            arminunruhA
            arminunruh
            Global Moderator
            wrote on last edited by
            #5

            Sure, good point!

            E 1 Reply Last reply
            2
            • arminunruhA arminunruh

              Sure, good point!

              E
              E
              ernestobellei
              wrote on last edited by
              #6

              Hi @arminunruh and @mariusjopen,

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

              Best,
              Ernesto

              1 Reply Last reply
              0
              • mariusjopenM
                mariusjopenM
                mariusjopen
                Global Moderator
                wrote on last edited by
                #7

                Hi @ernestobellei
                I will check back with Armin.

                Best!

                Marius

                www.mariusjopen.world

                1 Reply Last reply
                0
                • arminunruhA
                  arminunruhA
                  arminunruh
                  Global Moderator
                  wrote on last edited by
                  #8

                  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
                  0
                  • arminunruhA arminunruh

                    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
                    E
                    ernestobellei
                    wrote on last edited by
                    #9

                    Hi @arminunruh ,

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

                    Best,
                    Ernesto

                    1 Reply Last reply
                    0
                    • mariusjopenM
                      mariusjopenM
                      mariusjopen
                      Global Moderator
                      wrote on last edited by
                      #10

                      Hi @ernestobellei
                      I will check back with Armin.

                      Best!

                      Marius

                      www.mariusjopen.world

                      1 Reply Last reply
                      0
                      • arminunruhA
                        arminunruhA
                        arminunruh
                        Global Moderator
                        wrote on last edited by
                        #11

                        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
                        0

                        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
                        Reply
                        • Reply as topic
                        Log in to reply
                        • Oldest to Newest
                        • Newest to Oldest
                        • Most Votes


                        Online Users
                        Forgot your key, lost your files, need a previous Lay Theme or Addon version? Go to www.laykeymanager.com
                        laytheme.com
                        • Login

                        • Don't have an account? Register

                        • Login or register to search.
                        • First post
                          Last post
                        0
                        • Recent
                        • Tags
                        • Popular
                        • Users
                        • Search