webguync Posted August 16, 2010 Share Posted August 16, 2010 Hi, I have some code which is supposed to make a div appear with text inside after a set timed amount has passed. I am trying it out and it does seem to be working (appearing). Here is what I am doing. JavaScript <script language="javascript" type="text/javascript" src="js/Validation.js"></script> <script type="text/javascript"> $setTimeout(function() { $('#object').slideDown().fadeOut(50).fadeIn(50).fadeOut(50).fadeIn(50).fadeOut(50).fadeIn(50); }, 2000); //close the message box when the cross image is clicked $("#close_message").click(function() { $("#object").fadeOut("slow"); }); }); </script> and the html looks like this: <div id="object" class="message"> <img id="close_message" style="float:right;cursor:pointer" src="images/12-em-cross.png" /> <p><strong>Your time is up! Please submit your answers!</strong></p> </div> CSS... .message{ border:5px solid #CCCCCC; position:absolute; width:150px; border:1px solid #c93; background:#ffc; padding:5px; right:0px; top : -140px; } any ideas on what I am doing wrong? Quote Link to comment Share on other sites More sharing options...
JasonLewis Posted August 17, 2010 Share Posted August 17, 2010 No need for the $ at the start of setTimeout. setTimeout(function() { $('#object').slideDown().fadeOut(50).fadeIn(50).fadeOut(50).fadeIn(50).fadeOut(50).fadeIn(50); }, 2000); You could also try placing an alert inside the setTimeout to see if it's actually working. And why so many effects? Quote Link to comment Share on other sites More sharing options...
webguync Posted August 17, 2010 Author Share Posted August 17, 2010 ok thanks. The effects are to make it bounce after it appears. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.