2.0.4 • Published 4 years ago

@borngroup/born-modal v2.0.4

Weekly downloads
143
License
ISC
Repository
github
Last release
4 years ago

BORN Modal

Very simple module to create modals on the fly. Features callbacks and open/update/close methods.

Options

content: HTMLElement || String HTMLElement or String which contains all the content for your Modal.

modalID: String Default: random string. Unique ID for the Modal. If a Modal with the same ID is present, said Modal will open instead.

container: HTMLElement || String Default: document.body. Specify a container for the Modal. Can be an HTMLElement or a selector string.

keepAlive: Boolean Default: true. If set to false, the Modal will be removed from the DOM after closing it.

openImmediately: Boolean Default: true. Open the Modal immediately after creating it.

Callbacks

beforeOpenCallback: function Runs every time before the Modal is opened or updated. If false is returned, Modal won't open nor update.

afterOpenCallback: function Runs every time after the Modal opens.

afterCloseCallback: function Runs every time after the Modal is closed.

afterCreateCallback: function Runs once after the Modal is initially created. If keepAlive is true it will run every time the Modal opens.

Methods

You can run these on your new Modal instance:

open: or yourModalElement.modal.open();

close: or yourModalElement.modal.close();
parameters: None

update: or yourModalElement.modal.update(); parameters:
'content': String || HTMLElement HTML string or HTMLElement to update the Modal with.
'newID': String Changes the updated Modal's ID to this value.

Usage

var myModal = new Modal({
	modalID:		        'custom-unique-id',
	modalClass: 	        'homepage-modal',
	content: 	            '<p>Content for the Modal here</p>',
	beforeOpenCallback: 	function(modal) {
	                            if (someCondition) {
	                                //Do something.
	                                return true;
	                            }
	                            return false;
	                        }
});
2.0.3

4 years ago

2.0.2

4 years ago

2.0.4

4 years ago

2.0.1

4 years ago

2.0.0

4 years ago

1.9.10

5 years ago

1.9.9

5 years ago

1.9.8

5 years ago

1.9.7

5 years ago

1.9.6

5 years ago

1.9.5

6 years ago

1.9.4

6 years ago

1.9.3

6 years ago

1.9.2

6 years ago

1.9.1

6 years ago

1.9.0

6 years ago

1.8.7

6 years ago

1.8.6

7 years ago

1.8.5

7 years ago

1.8.4

7 years ago

1.8.3

7 years ago

1.8.2

7 years ago

1.8.1

7 years ago

1.8.0

7 years ago

1.7.0

7 years ago

1.6.0

7 years ago

1.5.3

7 years ago

1.5.2

7 years ago

1.5.1

7 years ago

1.5.0

7 years ago

1.4.0

7 years ago

1.3.0

7 years ago

1.2.0

7 years ago

1.1.0

7 years ago

1.0.14

7 years ago

1.0.13

8 years ago

1.0.12

8 years ago

1.0.11

8 years ago

1.0.10

8 years ago

1.0.9

8 years ago

1.0.8

8 years ago

1.0.7

8 years ago

1.0.6

8 years ago

1.0.5

8 years ago

1.0.4

8 years ago

1.0.3

8 years ago

1.0.2

8 years ago

1.0.1

8 years ago

1.0.0

8 years ago