Sometimes, when loading a page, you need to bring up a small prompt box in the lower right corner of the page to display some prompt information to the user. By using the jQuery message plug-in, you can easily achieve this effect, before using the message plug-in, let's first introduce how to use it.
1. $. messager. lays (width, height );
This method is mainly used to define the width and height of the pop-up window.
2. $. messager. anim (type, speed );
This method mainly defines the mode and speed at which the window is displayed.
$. Messager. anim ("fade", 1000); // displays it in an animated manner of fadeIn.
$. Messager. anim ("show", 1000); // animated display by show
3. $. messager. show (title, text, time );
This method mainly defines the content displayed in the window and how long the window will be hidden.
If the default title is used, the title is set to 0, and the title and text can be set to html for display. If you want to click the close button in the pop-up window to close the message box, you can set time to 0.
$. Messager. show (0, "This is a prompt", 5000 );
$. Messager. show ("message", "Welcome to blog", 3000 );
After understanding the functions of each method in the message plug-in, it is easy to use. The specific operations are as follows:
1. Introduce the jquery. js and jquery. messager. js files on the page.
2. When loading the page, call the function in the message plug-in to set the window size, display effect, and display content.
The Code is as follows:
$ (Function (){
$. Messager. lays (200,200 );
$. Messager. anim ('fade, 1000 );
$. Messager. show ("prompt message", "script home", 5000 );
});
3. The final result is shown in.
Online Demo address http://demo.jb51.net/js/jquery.messager/index.html
Jquery. message. js package http://www.jb51.net/jiaoben/22351.html