2.1.0 • Published 5 years ago

simple-domodal v2.1.0

Weekly downloads
45
License
-
Repository
github
Last release
5 years ago

Simple Domodal

npm

Simple modal using Domodule

Installation

npm install simple-domodal

Usage

JavaScript

import 'simple-domodal';
// or
import SimpleModal from 'simple-domodal';

HTML

...

<body>
  <button aria-controls="some-id">This aria-controls will open the modal</button>

  <div id="some-id"
       class="modal"
       data-module="SimpleModal"
       data-module-auto-open="false"
       data-module-closable="true"
       role="dialog"
       tabindex="-1">

    <div class="modal-content padding-md text-center" data-name="modal">
      <button class="modal-close" data-action="close" aria-label="Close modal">
        <span aria-hidden="true">×</span>
      </button>
    </div>
  </div>

  <script src="simple-domodal.js"></script>
</body>

Events

Custom events are fired on open/close and you can fire an event to open the modal.

EventWhereWhen
modal:revealIf fired on the modal, the modal will open.
modal:openedOn the modal.On modal open.
modal:closedOn the modal.On modal close.

Options

OptionDefaultAction
autoOpenfalseIf true the modal will open on pageload.
closabletrueIf true modal won't disappear on close.
focusModal ElementElement that will gain focus once the modal is opened.
2.1.0

5 years ago

2.0.1

5 years ago

2.0.0

5 years ago

1.2.0

5 years ago

1.1.1

6 years ago

1.1.0

6 years ago

1.0.3

6 years ago

1.0.2

6 years ago

1.0.1

6 years ago

1.0.0

6 years ago