• 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.

My first written module

Scheduled Pinned Locked Moved Development
12 Posts 3 Posters 2.2k 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.
  • B Offline
    BKeyport Module Developer
    last edited by Apr 17, 2020, 3:21 AM

    OK… so, I figured out CSS except for how to write the file to work with magic mirror - this is where the documentation don’t exist.

    Some CSS files have the module name in front of the css class, like “.MMM-NewsFeedTicker .tickerbody” - others just have the class as “.tickerbody” - what’s the difference?

    Thanks!

    The "E" in "Javascript" stands for "Easy"

    L 1 Reply Last reply Apr 17, 2020, 12:05 PM Reply Quote 0
    • L Offline
      lavolp3 Module Developer @BKeyport
      last edited by sdetweil Sep 11, 2022, 1:11 PM Apr 17, 2020, 12:05 PM

      @BKeyport In this case css works in hierarchies.

      It looks in the webpage from top (document) to bottom for the classes, ids or elements you give it. When the page is loaded all the css files present (main.css, custom.css all module css) are being merged into one big css pool.
      Giving it the hierarchy of classes (or elements), you can specify the css adaption.

      Imagine your module has a class “.tickerbody” and another modules does as well.

      Then, if you reference it in your custom.css, .tickerbody would apply the properties to BOTH modules.
      But if you use .MMM-yourmodule .tickerbody it is only applied to the class tickerbody that is A CHILD OF the class .MMM-yourmodule.
      You could also use something like .MMM-yourmodule div (note the missing . before div, meaning not a class is referenced but an element) which would affect ALL divs that are child elements of your module. Or .MMM-yourmodule .tickerbody spanwhich would affect all spans in the tickerbody of YOUR module.
      In main.css you can see things like ‘.dimmed’. This affects ALL elements of the whole mirror with the class .dimmed and gives the respective color.

      Every module gets it’s own name as class, this is general MM behaviour.

      How to troubleshoot modules
      MMM-soccer v2, MMM-AVStock

      L B 2 Replies Last reply Apr 17, 2020, 12:10 PM Reply Quote 0
      • L Offline
        lavolp3 Module Developer @lavolp3
        last edited by Apr 17, 2020, 12:10 PM

        @BKeyport Have you seen this?
        https://forum.magicmirror.builders/topic/6808/css-101-getting-started-with-css-and-understanding-how-css-works?_=1587124513929

        How to troubleshoot modules
        MMM-soccer v2, MMM-AVStock

        1 Reply Last reply Reply Quote 0
        • B Offline
          BKeyport Module Developer @lavolp3
          last edited by Apr 17, 2020, 9:30 PM

          @lavolp3 Wow. that’s a really handy description, Thanks.

          The "E" in "Javascript" stands for "Easy"

          1 Reply Last reply Reply Quote 0
          • B Offline
            BKeyport Module Developer
            last edited by Apr 17, 2020, 10:36 PM

            Capture.PNG

            Well, there it is. My silly little module. Pretty.

            The "E" in "Javascript" stands for "Easy"

            S 1 Reply Last reply Apr 17, 2020, 10:43 PM Reply Quote 1
            • S Offline
              sdetweil @BKeyport
              last edited by Apr 17, 2020, 10:43 PM

              @BKeyport nice work!

              Sam

              How to add modules

              learning how to use browser developers window for css changes

              1 Reply Last reply Reply Quote 0
              • B Offline
                BKeyport Module Developer
                last edited by Apr 19, 2020, 10:06 AM

                Ah, the heck with it. It’s released!

                The "E" in "Javascript" stands for "Easy"

                1 Reply Last reply Reply Quote 1
                • 1
                • 2
                • 1 / 2
                1 / 2
                • First post
                  10/12
                  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