Created
May 17, 2011 10:17
-
-
Save c4urself/976242 to your computer and use it in GitHub Desktop.
Highlight and Hide your Django messages
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
<!DOCTYPE html> | |
<html> | |
<head> | |
<link rel="stylesheet" type="text/css" href="style.css" /> | |
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.5.1/jquery.js"></script> | |
<script type="text/javascript" src="script.js"></script> | |
<script type="text/javascript" src="jquery-ui-1.8.12.custom.min.js"></script> | |
</head> | |
<body> | |
<header> | |
<div id="messages-container"> | |
<ul class="messages"> | |
<li class="info">Test info</li> | |
<li class="error">Test info</li> | |
<li class="success">Test info</li> | |
</ul> | |
</div> | |
</header> | |
</body> | |
</html> |
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
window.messaging = window.messaging || {}; | |
messaging.highlightAndHide = function() { | |
oMsgContainer = jQuery('div#messages-container > ul.messages'); | |
jQuery('li', oMsgContainer).each(function() { | |
var li = jQuery(this); | |
var opts = {'background-color': '#feae00','color': '#ffffff','border-color': '#000000'}; | |
var orig = {'background-color': li.css('background-color'),'color': li.css('color'),'border-color': li.css('border-color')}; | |
li.animate(opts, 'slow'); | |
li.animate(orig, 'slow'); | |
}); | |
setTimeout(function(){ | |
oMsgContainer.slideUp(); | |
}, 4000); | |
}; | |
jQuery(document).ready(function() { | |
messaging.highlightAndHide(); | |
}); |
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
.info { | |
background-color: #e7f6fd; | |
color: #27aae1; | |
border-width: 1px; | |
border-style: solid; | |
border-color: #27aae1; | |
} | |
.success { | |
background-color: #c9f4b9; | |
color: #52b52b; | |
border-width: 1px; | |
border-style: solid; | |
border-color: #52b52b; | |
} | |
.error { | |
background-color: #F2C2CC; | |
color: #E63235; | |
border-width: 1px; | |
border-style: solid; | |
border-color: #870508; | |
} | |
#messages-container { | |
width: 100%; | |
height: 25px; | |
top: 0px; | |
position: absolute; | |
} | |
html { | |
overflow-x: hidden; | |
} | |
ul { | |
list-style: none; | |
padding: 0px; | |
margin: 0px; | |
} | |
li { | |
display: block; | |
width: 940px; | |
padding: 8px; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment