Learn how to use $. messager. show and learn. messager. show.

Source: Internet
Author: User

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 ;}

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.