Html5 + css3 implement the toast prompt on the mobile phone, html5css3

Source: Internet
Author: User

Html5 + css3 implement the toast prompt on the mobile phone, html5css3

<! DOCTYPE html>
<Html>
<Head>
<Meta charset = "UTF-8">
<Meta name = "apple-touch-fullscreen" content = "YES"/>
<Meta name = "viewport" content = "width = device-width, initial-scale = 1.0, minimum-scale = 1.0, maximum-scale = 1.0, user-scalable = no "/>
<Meta name = "apple-mobile-web-app-capable" content = "yes"/>
<Meta name = "format-detection" content = "telephone = no"/>
<Meta name = "author" content = "webkfa.com"/>
<Title> html5 + css3 Implementation of mobile toast prompt -webkfa.com </title>
<Style>
*{
Margin: 0; padding: 0;
-Webkit-touch-callout: none;/* prevent callout to copy image, etc when tap to hold */
-Webkit-text-size-adjust: none;/* prevent webkit from resizing text to fit */
-Webkit-tap-highlight-color: rgba (210,210,210, 0.35);/* make transparent link selection, adjust last value opacity 0 to 1.0 */
-Webkit-user-select: none;/* prevent copy paste, to allow, change 'none' to 'text '*/
}
Body {font-family: ""; font-size: 12px ;}
Ul, li {list-style: none ;}

. Toasttj2 {z-index: 1003; font-size: 1.37em; position: fixed; bottom: 25%; width: 100%; opacity: 0; height: 24px; display: none;
Transition: opacity 1 s switching-out;
}
. Huati_btn {width: 175px; height: 32px; background: #34a0f0; border-radius: 3px; font: 14px/32px ""; display: block; overflow: hidden; margin: 0 auto; text-align: center; color: # fff; text-decoration: none ;}
. Huati {height: 40px; padding-top: 9px; border-bottom: 1px dashed # cecece}
</Style>
</Head>

<Body>
<P class = "huati"> <a href = "javascript: test (1);" class = "huati_btn"> test </a> </p>
<P class = "huati"> <a href = "javascript: test (2);" class = "huati_btn"> test 2 </a> </p>
<Div id = "toastId2" class = "toasttj2" style = "display: none; opacity: 0;"> </div>
<Script type = "text/javascript">
Function $ S (s) {return document. getElementById (s );}
Function $ html (s, html) {$ S (s). innerHTML = html ;}
Var toastTime2 = null;
Var displayTime2 = null;
Function setToast3 (html ){
If (toastTime2! = Null ){
ClearTimeout (toastTime2 );
ClearTimeout (displayTime2 );
}
$ S ('toastid2'). style. display = 'block ';
$ S ('toastid2'). style. opacity = 1;
$ Html ('toastid2', html );
ToastTime2 = setTimeout (function (){
$ S ('toastid2'). style. opacity = 0;
DisplayTime2 = setTimeout (function () {$ S ('toastid2'). style. display = 'none' ;}, 1000 );
},1000 );
}
Function test (f ){
If (1 = f ){
SetToast3 ('<div style = "color: # fff; background: rgba (0, 0, 0, 0.6); border-radius: 2px; padding: 2px; text-align: center; width: 175px; margin: 0 auto; "> the topic set content cannot be blank </div> ');
} Else if (2 = f ){
SetToast3 ('<div style = "color: # fff; background: rgba (0, 0, 0, 0.6); border-radius: 2px; padding: 2px; text-align: center; width: 235px; margin: 0 auto; "> the topic set content can contain up to 200 words </div> ');
}
}
</Script>
</Body>

</Html>

Online test code: http://www.webkfa.com/one4/w1620.html

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.