Notice: The Monaca & Onsen UI Community Forum is shutting down.

For Onsen UI bug reports, feature requests and questions, please use the Onsen UI GitHub issues page. For help with Monaca, please contact Monaca Support Team.

Thank you to all our community for your contributions to the forum. We look forward to hearing from you in the new communication channels.

Function does not start by itself (on pageload)

  • Hi all,
    I would like an animation to autostart on page load. I’m in the Onsen UI V2 JS Splitter example within the ons-template in an ons-page.

    I found that adding a script tag between the “/ons-page” and the “/ons-template” tags gets read (this took me quite some time… (-; )

    I added this:

    document.addEventListener("init", function(event) {
      if ( == "score.html") {
    }, false);

    Nothing happened.

    I added this

       setTimeout(function(){ Progress1(); }, 3000);

    The function starts! (thank you @Andi ) But only the first time the page is opened. The second time: nothing happens. On reload it usually works (not always).

    I added a button that called the function

             <div class="right">
            <ons-toolbar-button onclick="Progress1()">
            <ons-icon icon="md-menu"></ons-icon> 

    This always works.

    Any ideas why the function won’t start and what to do about it?

  • Onsen UI

    @Remco-Koffijberg Hello! The page is only initialized once, so init event won’t work for you. You can try with show event instead.

  • Aha, that clarifies something. (-; But it doesn’t do anything though.