Skip welcome & menu and move to editor
Welcome to JS Bin
Load cached copy from
 
<!DOCTYPE html>
<html>
<head>
  
<script src="http://code.jquery.com/jquery-2.1.0.min.js"></script>
  <meta charset="utf-8">
  <title>JS Bin</title>
  <style type="text/css">
     .simple-alert{display:block;position:fixed;z-index:7000;text-align:center;display:none}.simple-alert-span{display:inline-block;border-radius:5px;color:#fff;font-size:18px;line-height:25px;padding:7px 14px;margin:0 20px;background-color:#313131}.simpleAlertIn,.simpleAlertOut{animation-duration:.5s;animation-timing-function:ease;animation-fill-mode:both;backface-visibility:visible !important;-webkit-animation-duration:.5s;-webkit-animation-timing-function:ease;-webkit-animation-fill-mode:both;-webkit-backface-visibility:visible !important;-ms-animation-duration:.5s;-ms-animation-timing-function:ease;-ms-animation-fill-mode:both;-ms-backface-visibility:visible !important;-moz-animation-duration:.5s;-moz-animation-timing-function:ease;-moz-animation-fill-mode:both;-moz-backface-visibility:visible !important;-o-animation-duration:.5s;-o-animation-timing-function:ease;-o-animation-fill-mode:both;-o-backface-visibility:visible !important}.simpleAlertIn{animation-name:simpleAlertIn;-webkit-animation-name:simpleAlertIn;-ms-animation-name:simpleAlertIn;-moz-animation-name:simpleAlertIn;-o-animation-name:simpleAlertIn}.simpleAlertOut{animation-name:simpleAlertOut;-webkit-animation-name:simpleAlertOut;-ms-animation-name:simpleAlertOut;-moz-animation-name:simpleAlertOut;-o-animation-name:simpleAlertOut}@keyframes simpleAlertIn{0%{transform:perspective(400px) rotateX(90deg);opacity:0}40%{transform:perspective(400px) rotateX(-10deg)}70%{transform:perspective(400px) rotateX(10deg)}100%{transform:perspective(400px) rotateX(0deg);opacity:1}}@keyframes simpleAlertOut{0%{transform:perspective(400px) rotateX(0deg);opacity:1}100%{transform:perspective(400px) rotateX(90deg);opacity:0}}@-webkit-keyframes simpleAlertIn{0%{-webkit-transform:perspective(400px) rotateX(90deg);opacity:0}40%{-webkit-transform:perspective(400px) rotateX(-10deg)}70%{-webkit-transform:perspective(400px) rotateX(10deg)}100%{-webkit-transform:perspective(400px) rotateX(0deg);opacity:1}}@-webkit-keyframes simpleAlertOut{0%{-webkit-transform:perspective(400px) rotateX(0deg);opacity:1}100%{-webkit-transform:perspective(400px) rotateX(90deg);opacity:0}}@-ms-keyframes simpleAlertIn{0%{-ms-transform:perspective(400px) rotateX(90deg);opacity:0}40%{-ms-transform:perspective(400px) rotateX(-10deg)}70%{-ms-transform:perspective(400px) rotateX(10deg)}100%{-ms-transform:perspective(400px) rotateX(0deg);opacity:1}}@-ms-keyframes simpleAlertOut{0%{-ms-transform:perspective(400px) rotateX(0deg);opacity:1}100%{-ms-transform:perspective(400px) rotateX(90deg);opacity:0}}@-moz-keyframes simpleAlertIn{0%{-moz-transform:perspective(400px) rotateX(90deg);opacity:0}40%{-moz-transform:perspective(400px) rotateX(-10deg)}70%{-moz-transform:perspective(400px) rotateX(10deg)}100%{-moz-transform:perspective(400px) rotateX(0deg);opacity:1}}@-moz-keyframes simpleAlertOut{0%{-moz-transform:perspective(400px) rotateX(0deg);opacity:1}100%{-moz-transform:perspective(400px) rotateX(90deg);opacity:0}}@-o-keyframes simpleAlertIn{0%{-o-transform:perspective(400px) rotateX(90deg);opacity:0}40%{-o-transform:perspective(400px) rotateX(-10deg)}70%{-o-transform:perspective(400px) rotateX(10deg)}100%{-o-transform:perspective(400px) rotateX(0deg);opacity:1}}@-o-keyframes simpleAlertOut{0%{-o-transform:perspective(400px) rotateX(0deg);opacity:1}100%{-o-transform:perspective(400px) rotateX(90deg);opacity:0}}
    *{
    margin: 0px;
    padding: 0px;
    background: transparent;
    border: 0px;
    outline: none;
    box-shadow: none;
    border-radius: 0px;
}
body {
    background-color: #e1e1e1;
    padding: 50px 0px;
    font-family:  "lucida sans unicode", "lucida grande";
    font-style: 16px;
    color: #212121;
    -webkit-touch-callout: none;
}
#main_title {
    position: relative;
    font-size: 24px;
    line-height: 30px;
    text-align: center;
    font-weight: bold;
    color: #515151;
    padding-bottom: 230px;
}
.button{
    position: relative;
    margin: 20px auto;
    padding: 5px;
    width: 250px;
    height: 40px;
    line-height: 40px;
    text-align: center;
    color: #e1e1e1;
    font-size: 24px;
    background-color: #355368;
    border-radius: 5px;
    cursor: pointer;
}
.button:hover{
    color: #f1f1f1;
    background-color: #273138;
}
.custom{
    background-color: #7A3220;
    color: #f1f1f1;
}
  </syle>
</head>
<body>
  <div id="main_title">
        Simple alert with CSS3 animation by Wei Jia
    </div>
    <div id="alert" class="button">default Alert</div>
    <div id="warn" class="button">cunstom Alert</div>
<script>
    (function($){var body=$("body"),win=$(window),t1,t2,t3,span=document.createElement('span'),text_span=$(span),alert=$(document.createElement('div')),position=function(_alert){_alert.width(win.width()).css("top",win.height()*0.2);},remove=function(){alert.hide();text_span.removeClass("simpleAlertIn simpleAlertOut").removeClass("custom");},alertIn=function(text,param){var time=1500;remove();clearTimeout(t1);clearTimeout(t2);clearTimeout(t3);t3=setTimeout(function(){if(param)
{if(param.time)
{time=param.time;}
if(param.class)
{text_span.addClass(param.class);}}
alert.show();text_span.addClass("simpleAlertIn").html(text);t1=setTimeout(function(){text_span.addClass("simpleAlertOut");t2=setTimeout(function(){remove();},600);},time+600);},1);};alert.addClass('simple-alert').append(span);text_span.addClass('simple-alert-span')
position(alert);body.prepend(alert);$.alert=function(text,param){alertIn(text,param);};win.resize(function(){position(alert);});})($);
  </script>
</body>
</html>
Output

You can jump to the latest bin by adding /latest to your URL

Dismiss x
public
Bin info
kahitomipro
0viewers