<section id="relative-positioning" class="animate-things-wrapper">
    <button id="trigger">Trigger</button>

    <div id="box" class="box">
        Hi there
    </div>
</section>

<script src="../../js/components/relative-positioning.js"></script>
<section id="relative-positioning" class="animate-things-wrapper">
    <button id="trigger">Trigger</button>

    <div id="box" class="box">
        Hi there
    </div>
</section>

<script src="{{ path '/js/components/relative-positioning.js' }}"></script>
/* No context defined. */
  • Content:
    (function () {
      document.addEventListener('DOMContentLoaded', function () {
        console.log("relative-positioning active");
    
        const button = document.querySelector('#trigger');
        const box = document.querySelector('#box');
    
        button.addEventListener('click', function() {
          box.classList.toggle('active');
        })
      });
    })();
    
  • URL: /components/raw/relative-positioning/relative-positioning.js
  • Filesystem Path: components/01-basic/04-relative-positioning/relative-positioning.js
  • Size: 337 Bytes
  • Handle: @relative-positioning
  • Preview:
  • Filesystem Path: components/01-basic/04-relative-positioning/relative-positioning.hbs

No notes defined.