laravel-modal-js
v1.0.8
Published
Laravel 5 modal
Downloads
13
Readme
Laravel-modal-js
Laravel-modal-js is a npm package for Laravel that provides modal window in your application.
Installation
Via npm
From the command line, run:
npm install laravel-modal-js --save-dev
Via .zip
Download file and unzip it in your application folder:
https://github.com/astratyandmitry/laravel-modal-js/archive/master.zip
Usage
In your main application JavaScript file just require laravel-modal-js
and initialize it.
window.Modal = require('laravel-modal-js').default;
Modal.init();
Open Modal
Any hyperlink with class of __js-modal__open
should popup modal window and try to request modal by href
attribute.
<a href="/forms/feedback/" class="__js-modal__open">Leave a message</a>
Close modal
Almost same story for closing modal window, just add class __js-modal__close
to any html element, and by click it should be hide.
<span class="icon icon-close __js-modal__close"></span>
API
Display
Method display
allow you to request modal window for server and show it on web-page.
Require parameter
href
, to get modal from server.
Show
Method show
allow you to launch modal window with passing html content of it.
require parameter
html
, modal content body.
Close
Method close
allow you to just empty modal content and hide it.