Support » Plugin: LoftLoader » Load beforeunload

  • Resolved lijitimit

    (@lijitimit)


    Is there a way to load on window.addEventListener “beforeunload”?

    Sometimes, there is a few moments where a user clicks a link and it takes some time to connect to the server before beginning the load process. I have a little script that shows a “shimmer” animation while the user waits for the load process. Is there a way to call your plugin at this point? Here’s the script I’m using, called before the closing </body>:

    <script type="text/javascript">
    window.addEventListener("beforeunload",function(e){
    document.body.classList.add("page-loading");
    },false);
    </script>

    This adds “page-loading” to the body class, which then uses pseudo class to show a css animation. What I’d really like is to trigger your plugin. Any chance this is possible?

    The page I need help with: [log in to see the link]

Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Author loftocean

    (@loftocean)

    Hi,

    Thank you for contacting us. Please see below:

    Option 1 – This feature is included in the Pro version.

    This is a feature that has been included in the Pro version, which called “Smooth Page Transition”. You may like to check our demo site to preview the effect.

    When this feature is enabled, when you click a link and leave the current page, the loader background will appear with animation again, to fulfil the blank between pages.

    You can check the online documentation to know more about this feature: Smooth Page Transition.

    Option 2 – You can write custom CSS code for your class name:

    We checked your website and found that the “page-loading” class has been added after clicking a link. Therefore, you can also choose to write CSS code for your class name to display the preloader. However, we are sorry that we are unable to provide assistance with the code because it is related to item customization. Thank you for your understanding. You can check the CSS code of our plugin as a reference.

    Option 3 – You can just remove the “loaded” class:

    If you just remove the “loaded” class from < body > tag after clicking a link, the preloader will show again, including the background and the loader animation, but without any transition effects.

    Hope this helps. Thank you very much.

    Best regards,
    The Loft.Ocean Team

    That was a very detailed and helpful answer, thank you. I generally like to support the developers who make the plugins I use. I realize the Pro version has a LOT more options, most of which I don’t need. If I go Pro, is there any additional “bulk” to the plugin that may affect site speed?

    Plugin Author loftocean

    (@loftocean)

    Hi,

    Thank you for your reply.

    Yes, there are more options in the LoftLoader Pro settings panel. But it is still a very lightweight plugin. Based on our tests and feedback from users of the Pro version, there is no significant difference in website speed when activating and deactivating LoftLoader Pro.

    Many thanks.

    Best regards,
    The Loft.Ocean Team

    Thanks again for the details.

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Load beforeunload’ is closed to new replies.