Last active
December 10, 2015 11:49
-
-
Save shuhaowu/4430444 to your computer and use it in GitHub Desktop.
Status message like the gmail sending messages. An updated version of http://code.google.com/p/humanmsg/, perhaps you can see from some functions This has been DEPRECATED. Use https://github.com/shuhaowu/awesome-statusmsg instead
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
# This has been deprecated. Use https://github.com/shuhaowu/awesome-statusmsg instead | |
window["statusmsg"] = statusmsg = {} | |
# statusmsg = namespace "statusmsg" | |
# I use my own namespace function from coffeecrispt so not sure how well that first line works. | |
# To use, do statusmsg.setup() at document load | |
# Then you can do statusmsg.display("Your text") and close via statusmsg.close() | |
set_human_msg_css = (msgbox) -> | |
msgbox.css("position", "fixed").css("left", ($(window).width() - $(msgbox).outerWidth()) / 2) | |
statusmsg["setup"] = (appendTo="body", msgOpacity=0.8, msgID="statusmsg") -> | |
statusmsg.msgID = msgID | |
statusmsg.msgOpacity = msgOpacity | |
statusmsg.msgbox = $('<div id="' + statusmsg.msgID + '" class="statusmsg"></div>') | |
$(appendTo).append(statusmsg.msgbox) | |
$(window).resize(() -> | |
set_human_msg_css(statusmsg.msgbox) | |
) | |
$(window).resize() | |
statusmsg["display"] = (msg) -> | |
statusmsg.msgbox.html(msg) | |
set_human_msg_css(statusmsg.msgbox) | |
statusmsg.msgbox.fadeIn() | |
statusmsg["close"] = () -> | |
statusmsg.msgbox.fadeOut() |
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
.statusmsg { position: fixed; top: 2em; color: #000; border-radius: 5px; background-color: #D4FFA8; text-align: center; display: none; z-index: 1000; padding: 0.5em 0.8em; } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment