Message notification box (JAVASCRIPT+CSS3)

Source: Internet
Author: User

Recently, the company's project has been given a message feedback box. Feel good and take it out and share it with you.

JavaScript section:

The parameters of the entry and exit are the default parameters except for Allnwesid, which have default values. You can modify it yourself. Click to zoom Out

Message Bar    Overall class= "Zwei_prompt"    title class= "Zwei_prompt_title"   content class= "Zwei_prompt_ Content "//news = new zwei. News ({//     "Allnewsid":  "Father element id",//     "title":  "title str",//      "Content":  "contents str",//     "color":  "BLACK",//      "Interval":  "existence time int"//});     zwei. news = function  (param)  {        this.content  = param.content | |   "What do you want to say?!";         this.title = param.title | |   "Day alien Sound";         this.interval = param.interval | |  3;        this.color = param.color | |   "BLACK";         this.clickpass = false;  &nBsp;     this.allnews = document.getelementbyid (param.allnewsId);         this.showEnd = function  (News)  {             if  (This.clickpass === false)   {                settimeout ( function  ()  {                     news.parentnode.removechild (News);                 }, 500);             }             news.style.transform =  "Scale (0.3)";             news.style.webkittransform =  "Scale (0.3)";        };         this.init = function  ()  {             var news = document.createelement ("div"),                 content =  Document.createelement ("P"),                 title = document.createelement ("P"),                 _this = this;             news.className =  "Zwei_prompt";             news.style.borderColor = this.color;             content.innerhtml = this.content;             content.classlist.add ("Zwei_prompt_content");             news.appendchild (content);             title.innerHTML = this.title;             title.classlist.add ("Zwei_prompt_title");             news.insertbefore (title, content);             this.allnews.appendchild (News);             news.onclick = function  ()  {                 _this.showend (News);                 news.onclick = null;                 _this.clickpass = true;             };             settimeout (function  ()  {                 _this.showend (News);             }, this.interval * 1000);         };        this.init ();    };

And there is the CSS code:

The style is simple, you can change it.

. zwei_prompt {position:relative;    top:0;    width:370px;    BORDER:1PX Black Solid;    margin:10px 0;    Transition:all 0.5s ease-in;    -webkit-transition:all 0.5s ease-in;    Cursor:pointer;    border-radius:10px; BORDER:2PX black Solid;}. Zwei_prompt_title:before,. zwei_prompt_title:after{content: "———————";}.    zwei_prompt_content,.zwei_prompt_title {text-align:center; Word-wrap:break-word;}. zwei_prompt_content {margin:20px 7px;}

As for some people ask Zwei is what ... That is my own JavaScript library, later, and so mature also posted out for everyone to see.

Ps:zwei is 2 in German.

Put a few pictures on it:



Message notification box (JAVASCRIPT+CSS3)

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.