MagicMirror Forum
    • Recent
    • Tags
    • Unsolved
    • Solved
    • MagicMirror² Repository
    • Documentation
    • 3rd-Party-Modules
    • Donate
    • Discord
    • Register
    • Login
    A New Chapter for MagicMirror: The Community Takes the Lead
    Read the statement by Michael Teeuw here.

    Move / load div modules around

    Scheduled Pinned Locked Moved Troubleshooting
    4 Posts 3 Posters 2.3k Views 3 Watching
    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.
    • romainR Offline
      romain
      last edited by

      Hello guys, I have an issue. I want to controle the visibility and the module’s position at run time without edition the config file.
      I made a module (well, I edited an existing module to fit my needs but that doesn’t matter) to do that.
      Show and hide module is easy enough.
      as for moving them, my methode is to get div of the module on the screen, get the div of the region I want to put it in (it’s inside container actually) then appendChild.
      That’s works fine.

      BUT, my end goal is to have lot’s of module (more than the screen can show at one time) and control where I put them and if I need to show them or not at run time. Obviously I don’t want to have them all at screen at startup. I would like to have most of them hidden. but if I don’t set a position, the dev of the module is never created and therefor I can’t move it.

      How can I do that ? How can I create the div of the module if no position was given ? (I noticed the divs have different value for the style depending on the modules, and I don’t know where to find those information so I can’t really create a generic function to create the div). if every module had the same style it would be no problem but that’s not the case

      I would like to avoid editing the index.html if possible.

      A 1 Reply Last reply Reply Quote 0
      • A Offline
        Anhalter42 @romain
        last edited by

        @romain Why not set some random position and hide all (other) modules on startup with the method you use at runtime? As far as I know it is possible to get a list of all modules.

        MMM-ProfileSwitcher does something similar at startup (shows only modules with class “default” at start). Maybe you can look into their code to see how they do it?! Or you just use the MMM-ProfileSwitcher itself just to hide all modules at startup (quick and dirty).

        1 Reply Last reply Reply Quote 1
        • romainR Offline
          romain
          last edited by

          I choose your first idea to hide all other module at startup. It worked good enough

          1 Reply Last reply Reply Quote 0
          • R Offline
            reporter500
            last edited by

            Romain can you please tell me how you were able to do that?

            1 Reply Last reply Reply Quote 0
            • 1 / 1
            • First post
              Last post
            Enjoying MagicMirror? Please consider a donation!
            MagicMirror created by Michael Teeuw.
            Forum managed by Sam, technical setup by Karsten.
            This forum is using NodeBB as its core | Contributors
            Contact | Privacy Policy