/MessageBox-in-JQuery

A prompt window built in JQuery.

Primary LanguageJavaScript

MessageBox

A prompt window built in JQuery.

Demo: Here

Step 1.

Call JQuery and MessageBox.js

-------------------------------------------------------
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.2.4/jquery.min.js"></script>
<script src="MessageBox.js"></script>

Step 2.

Set html.

myBox is the div which to show.

-------------------------------------------------------
<div class="wrapper"></div>
<div id="myBox">My message is here.</div>

Step 3.

New a MessageBox object, and input options.

* target: (selector) Which div you want to show
* duration: (int) How many seconds will the box show
* wrapper: (selector) Box will show in the side of the wrapper
* side: (string) Which side
* margin: (int) How far between the box and wrapper
-------------------------------------------------------
var myMessageBox = new MessageBox({
    target: "#myBox",
    duration: 2,
    wrapper: ".wrapper",
    side: "right",
    margin: 0,
});

Step 4.

Call the method of MessageBox object, and myBox will show.

-------------------------------------------------------
myMessageBox.show();