Learn how to use $. messager. show and learn. messager. show.
1. a pop-up box is displayed at the cursor position!
Function showBySite (event) {var element = document. elementFromPoint (event. x, event. y); // get the click object $. messager. showBySite ({title: 'My title', msg: 'message. ', showType: 'show'}, {top: $ (element ). position (). top + $ (element ). height (), // set $. messager. show top is set to left: $ (element) under the clicked object ). position (). left, // set $. messager. show left is set to align with the clicked object bottom: ""});}/*** specifies the position to display $. messager. show * options $. messager. show options * param = {left, top, right, bottom} */$. extend ($. messager, {showBySite: function (options, param) {var site = $. extend ({left: "", top: "", right: 0, bottom:-document. body. scrollTop-document.doc umentElement. scrollTop}, param | |{}); var win =$ ("body> div. messager-body "); if (win. length <= 0) $. messager. show (options); win = $ ("body> div. messager-body "); win. window ("window" cmd.css ({left: site. left, top: site. top, right: site. right, zIndex: $. fn. window. defaults. zIndex ++, bottom: site. bottom });}});
2. in the lower right corner of the page, a dialog box is displayed.
$. Messager. show ({title: "Recommended successfully", msg: "The news you recommended is: <br/> <span style = \" color: red; \ ">" + newstitle + "</span>", showType: 'slide', width: 300, height: 150, timeout: 2000 });
Note: If the frame (iframe) in the webpage is displayed, the pop-up box will also be in the bottom right corner of iframe!
$ Messagershow (0, 'Send you a Jquery Messager message pop-up plug-in '); does not work. A prompt box is not displayed.
Let the company design and design a pop-up window, write a pop-up window by yourself, compatibility, performance.
$ Messagershow () how to keep the window in the lower right corner of the screen
Set a default style format for the window, place the window in the lower right corner of the page, and call the scroll event of the window to reset the position of the window.
For example, this is a js with a button Layer Floating below the window.
$ (Window ). resize (function () {// reset window size setAutoHeight () ;}); $ (window ). scroll (function () {// setAutoHeight () ;}) when the window is rolling; $ (document ). ready (function () {// initialize setAutoHeight () ;}); function setAutoHeight () {var buttonObj =$ ("# buttonDiv"); var top = $ (document ). scrollTop () + $ (window ). height ()-buttonObj. height ()-20 rows buttonobj.css ({"top": top});} The following is the default layer style. startbar-wrapper {width: 100%; position: fixed; z-index: 1000; bottom: 0; height: 25px; _ position: absolute; text-align: center ;}