Last active
August 29, 2015 13:56
-
-
Save mpouncy-netpulse/9262504 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
.alertDot, .alertDotSpan { | |
text-align:center; | |
vertical-align:middle; | |
-webkit-transform-style:preserve-3d; | |
-webkit-transform-origin:left; | |
-webkit-transition:all 1s ease-in-out; | |
} | |
.alertDot { | |
display:inline-table; | |
margin:auto; | |
position:absolute; | |
top:50%; right:50%; bottom:auto; left:auto; | |
z-index:5000; | |
opacity:1; | |
min-width:100px; | |
min-height:60px; | |
-webkit-transform:translate(50%, -50%); | |
} | |
.alertDot.hide { | |
opacity:0; | |
-webkit-transform:translate(50%, -200%); | |
} | |
.alertDotSpan { | |
width:90%; | |
height:90%; | |
display:table-cell; | |
margin:5%; | |
background:#08F; | |
color:#FFF; | |
border-radius:100px; | |
-webkit-box-shadow:#08F 0 0 1px 1px, rgba(0,0,0,.5) 0 0 20px 10px; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html> | |
<head> | |
<script src="http://code.jquery.com/jquery-git2.js"></script> | |
<meta charset="utf-8"> | |
<title>Alert Dot</title> | |
</head> | |
<body> | |
<!--//--> | |
</body> | |
</html> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var alertDot = function alertDot(msg, duration, context) { | |
msg = (msg || ''); | |
duration = (duration || 6543); | |
context = (context || this); | |
context.clearInterval(context.alertDotTimer); | |
if (!context.$dotElm) { | |
context.$dotElm = $('<div class="alertDot hide"><span class="alertDotSpan"><!--//--></span></div>'); | |
$('body').append(context.$dotElm); | |
} | |
context.$dotElm.find('span').text(msg); | |
context.$dotElm.removeClass('hide'); | |
context.alertDotTimer = context.setTimeout(function closeAlertDot() { | |
context.$dotElm.addClass('hide'); | |
}, duration); | |
}; | |
$(document).ready(function documentReady() { | |
try { | |
alertDot('Ready to roll.'); | |
} catch (e) { | |
console.log(e); | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment