JavaScript to implement a simple page in the bottom right corner tip information Box _javascript tips

Source: Internet
Author: User
Tags bind cbtn

Because before finding an open source is very easy to use, can be fixed in the bottom right corner of the browser, compatibility is also good, and then affect the application of a small function point, decided to rewrite one; this can only be fixed on the current page of the lower right add, the system is up and down structure to meet the demand, not continue to expand;
Two functions:
1.lay--Set Cue box width (optional)
2.show--Set title, content, and stay time

Notice.js

var time;
var delaytime; $ (function () {///increase floating div $ (' body '). Append ("<div id= ' notice ' onselectstart= ' return false ' ><span class= ' notice _title ' > </span><span class= ' cbtn ' >[closed]</span><div class= ' notice_content ' ></
   
  Div></div> "); Change Style $ (' #notice '). CSS ({right: "0", Bottom: "0", cursor: "Default", Position: "Fixed", "Background-color": "#CFDEF4", Color: "#1F336B", "Z-index": "999", Border: "1px #1F336B solid", margin: "2px", padding: "10px", "font-weight": "Bold", "
  Line-height ": 25px", display: "None"}); $ (' #notice. cbtn '). CSS ({color: "#FF0000", cursor: "Pointer", "Padding-right": "5px", float: "Right", Position: "Relative
  "}); $ (' #notice. notice_content '). CSS ({margin: "3px", "font-weight": "Normal", border: "1px #B9C9EF solid", "line-height": "
   
  20px "," Margin-bottom ":" 10px ", padding:" 10px "});
      /* Bind Event/* (' #notice '). Hover (function () {$ (this). Stop (True,true) Slidedown ();
    Cleartimeout (time); The function () {time = settimeout (' _notIce () ', delaytime);
   
  }
  );
    Bind Shutdown Event $ ('. Cbtn '). Bind (' click ', Function () {$ (' #notice '). Slideup (' fast ');
  Cleartimeout (time);
});
});
  $.extend ({lay:function (_width,_height) {$ (' #notice '). css ({width:_width,height:_height});
     }, Show:function (_title,_msg,_time) {delaytime = _time;
     $ ('. Notice_title '). HTML (_title);
     $ ('. Notice_content '). HTML (_MSG);
     $ (' #notice '). Slidedown (2000);
  Time = settimeout (' _notice () ', delaytime);
},
});

 function _notice () {$ (' #notice '). Slideup (2000);}

Index.html

<! DOCTYPE HTML PUBLIC "-//W3C//DTD XHTML 1.0 transitional//en" "Http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd ">  

The above is the entire contents of this article, I hope you can enjoy.

Related Article

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.