Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
code review 13377
initPage is only called once and is logically related to the setTimeout so inline it there;
while at it, fix the setTimeout call and the click event
$(document).ready(function () {
var message = $('#message'),
tab = $('#tab'),
droid = message.find('.droid'),
speed = 300;
function slideMessage() {
var margin = message.css('marginTop');
if (margin !== "0px") {
tab.animate({top: "-90px"}, speed);
message.delay(speed).animate({marginTop: "0px"}, speed);
message.find('.droid').delay(1000).animate({bottom: "0px"}, 100);
} else {
message.find('.droid').delay(1000).css({bottom: "-60px"}, 100);
message.animate({marginTop: "-60px"}, speed);
tab.delay(speed).animate({top: "0px"}, speed);
//Hide message if user has javascript
message.css('marginTop', '-60px');
droid.css('bottom', '-60px');
setTimeout(slideMessage, 1000);
$('#message .close, #tab').click(slideMessage);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.