1.1.0 • Published 1 year ago

vulture-modal v1.1.0

Weekly downloads
-
License
ISC
Repository
-
Last release
1 year ago

Vulture-modal

Built with JavaScript

vulture-modal-js

Vulture-modal is a minimalist and easy-to-use modal plugin written in pure JavaScript.

Demo

It is still under development.

Features

  • Custom class name
  • Customizable (write your custom html in content)

Installation

  • Run the below command to add Vulture-modal to your exisitng or new project.
npm i vulture-modal

or

yarn add vulture-modal
  • Import Vulture-modal into your module to start using it.
import VultureModal from 'Vulture'

Adding Vulture-modal to HTML page using the traditional method

And the script at the bottom of the page

<script type="text/javascript" src="https://cdn.jsdelivr.net/npm/vulture-modal.js"></script>

Documentation

VultureModal.init({
  id: 'vulture-id',
  position: 'center',
  width: '250px',
  headerText: '🎉 Vulture Modal',
  contentText: '🦅 Vulture Content',
  className: false,
  html: null,
  footer: true,
  confirmButtonText: 'Confirm',
  cancelButtonText: 'Cancel',
  onShow: id => console.info(`${id} modal opened!`),
  onClose: id => console.info(`${id} modal closed!`)
})

Different ids should be used for each modal. After the modal is init you can show and close it as follows.

VultureModal.show('vulture-id') // Show modal
VultureModal.close('vulture-id') // Close modal

You should write the id of the modal you are initing inside the show and close functions.

API

Option KeytypeUsageDefaults
idstringThe id of the modal to be created"vulture-id"
position"center", "left", "right"To show the modal on center or left or right"center"
width"px", "%", "rem", "em"The modal width"250px"
headerTextstringText to be displayed on the modal"🎉 Vulture Modal"
contentTextstringText to be displayed in the content"🦅 Vulture Content"
classNamestringAbility to provide custom class name for further customization
htmlHTMLYou can write HTML code (used instead of contentText)
footerbooleanTo show the confirm and cancel button under the modaltrue
confirmButtonTextstringChange your confirm button text (Only if footer is true)"Confirm"
cancelButtonTextstringChange your cancel button text (Only if footer is true)"Cancel"
onShowFunctionInvoked when the modal is opened
onCloseFunctionInvoked when the modal is closed

License

ISC © Selim Hamzaoğulları

1.1.0

1 year ago

1.0.11

1 year ago

1.0.10

1 year ago

1.0.9

1 year ago

1.0.8

1 year ago

1.0.7

1 year ago

1.0.6

1 year ago

1.0.5

1 year ago

1.0.4

1 year ago

1.0.3

1 year ago

1.0.2

1 year ago

1.0.1

1 year ago

1.0.0

1 year ago