MagicMirror Forum
    • Recent
    • Tags
    • Unsolved
    • Solved
    • MagicMirror² Repository
    • Documentation
    • 3rd-Party-Modules
    • Donate
    • Discord
    • Register
    • Login
    1. Home
    2. jetnet
    A New Chapter for MagicMirror: The Community Takes the Lead
    Read the statement by Michael Teeuw here.
    J
    Offline
    • Profile
    • Following 0
    • Followers 0
    • Topics 1
    • Posts 1
    • Groups 0

    jetnet

    @jetnet

    0
    Reputation
    219
    Profile views
    1
    Posts
    0
    Followers
    0
    Following
    Joined
    Last Online

    jetnet Unfollow Follow

    Latest posts made by jetnet

    • Firing off Javascript after getDom elements have drawn on the page

      I am using Magic Mirror with bootstrap, jquery, and some custom javascript code to make touchscreen things happen on a module I am working on. If I fire off the javascript init function after the updateDom event, I don’t get an error, but the dom elements I am trying to run my function against are not yet part of the page, so nothing happens. As part of the debug process, I put a console log line in, so I can confirm that the javascript init() function ran. The module displays everything correctly, but the touch screen elements do not work.

      The module functions a lot like the newsfeed, so after 15 seconds, it calls back out to the server for a new update. If I don’t send it a new update (so it doesn’t redraw the html) but the javascript init fires again, now all of the touch screen elements work.

      Basically what I need to know is: where do I need to put the init() function call, in order to let all the dom elements draw on the page, so the javascript can see them? Is there an “afterGetDom” function I can run?

      I know i am not submitting the code along with this question, but the code is fairly length, and I didn’t want to paste it. If you guys need to see it, I can provide chunks of it.

      posted in Troubleshooting
      J
      jetnet