• Recent
  • Tags
  • Unsolved
  • Solved
  • MagicMirror² Repository
  • Documentation
  • 3rd-Party-Modules
  • Donate
  • Discord
  • Register
  • Login
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.

Module Position

Scheduled Pinned Locked Moved Development
34 Posts 5 Posters 13.2k Views 4 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.
  • M Offline
    maxbachmann
    last edited by May 16, 2018, 6:00 PM

    can I change the position of a module while MM2 is running?

    D 1 Reply Last reply May 16, 2018, 6:07 PM Reply Quote 0
    • D Offline
      dherl0623 @maxbachmann
      last edited by May 16, 2018, 6:07 PM

      @maxbachmann As far as I know, no. You can however update your position in the configuration file, then press CTRL+R to hard refresh the MM browser.

      1 Reply Last reply Reply Quote 0
      • M Offline
        maxbachmann
        last edited by May 16, 2018, 6:09 PM

        @dherl0623 ty Ik I can change it in there, but would have been cool to change during runtime so I can blend the module in at whatever place I currently need it ;) Well can’t change when it’s not possible

        S 1 Reply Last reply May 16, 2018, 8:44 PM Reply Quote 0
        • S Offline
          strawberry 3.141 Project Sponsor Module Developer @maxbachmann
          last edited by May 16, 2018, 8:44 PM

          @maxbachmann there is now magicmirror api for it, but you could manipulate the dom and set the module in a different region manually.

          Please create a github issue if you need help, so I can keep track

          1 Reply Last reply Reply Quote 2
          • M Offline
            maxbachmann
            last edited by maxbachmann May 16, 2018, 9:00 PM May 16, 2018, 9:00 PM

            @strawberry-3-141
            How can I do that in there (sorry I am a absolute noob with the dom)

            1 Reply Last reply Reply Quote 0
            • M Offline
              maxbachmann
              last edited by May 16, 2018, 9:08 PM

              I just asked my friend google:

               var d = document.getElementById(wrapper);
               d.style.left = newx_pos;
               d.style.top = newy_pos;
              

              is that how to do it?

              S 1 Reply Last reply May 16, 2018, 10:42 PM Reply Quote 0
              • S Offline
                strawberry 3.141 Project Sponsor Module Developer @maxbachmann
                last edited by May 16, 2018, 10:42 PM

                @maxbachmann no, you would get the module itself, the wrapper has an id with the identifier of the module, then you would get the wrapper of the position and would call appendChild with your module

                Please create a github issue if you need help, so I can keep track

                1 Reply Last reply Reply Quote 0
                • M Offline
                  maxbachmann
                  last edited by May 16, 2018, 11:40 PM

                  @strawberry-3-141 Can you help me with how that would look like in software? I am sorry this project is the first time I use javascript at all and absolutely clueless when it’s about the dom

                  S 1 Reply Last reply May 17, 2018, 5:38 AM Reply Quote 0
                  • S Offline
                    strawberry 3.141 Project Sponsor Module Developer @maxbachmann
                    last edited by May 17, 2018, 5:38 AM

                    @maxbachmann

                    // get the module to move with it's identifier
                    var clock = document.getElementById('module_0_clock');
                    
                    // append it to the region you like
                    document.querySelector('div.region.top.left div.container').appendChild(clock);    
                    

                    it will work only if you already have a module in that position, otherwise you need to ovverride the style to display block

                    document.querySelector('div.region.top.left div.container').style.display = 'block';
                    

                    that’s it

                    Please create a github issue if you need help, so I can keep track

                    1 Reply Last reply Reply Quote 1
                    • M Offline
                      maxbachmann
                      last edited by maxbachmann May 17, 2018, 8:43 AM May 17, 2018, 8:41 AM

                      @strawberry-3-141 So I always have to know wether there is already a element in that region? Is there a way to check all modules and return the ID’s of the elements that are in this position?

                      J 1 Reply Last reply May 17, 2018, 9:30 PM Reply Quote 0
                      • 1
                      • 2
                      • 3
                      • 4
                      • 1 / 4
                      1 / 4
                      • First post
                        10/34
                        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