Created
February 13, 2010 19:22
-
-
Save kellishaver/303638 to your computer and use it in GitHub Desktop.
javascript/css for floating flash notice
This file contains 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
#flash_notice { | |
width:400px; | |
padding:10px; | |
background:#dbffca; | |
color:#060; | |
height:30px; | |
line-height:30px; | |
border:1px solid #060; | |
font-family:arial, helvetica, sans-serif; | |
font-size:12pt; | |
margin-top:30px; | |
} |
This file contains 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
# dead simple, but just so I don't lose it... | |
function flash_notice(message) { | |
notice = $('<div></div>').attr('id', 'flash_notice').html(message); | |
notice.css('position', 'absolute'); | |
notice.css('z-index', 1050); | |
$('body').append(notice.hide()); | |
notice.css('left', ($('body').width() / 2) - (notice.width() / 2)) + 'px'; | |
notice.css('top', $(window).scrollTop() + 'px'); | |
notice.fadeIn(); | |
function remove_notice() { notice.fadeOut(function() { notice.remove() }); } | |
setTimeout(remove_notice, 3000); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment