#1
  1. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jun 2010
    Posts
    195
    Rep Power
    45

    FadeOut('slow') not working. <span> just disappears.


    EDIT: Nevermind, apparently fadeOut cannot be applied to a span, since it worked when I changed it to <p>.

    This should be pretty easy. Can one of you take a look at this code snippet and let me know if you see anything wrong.

    Basically, it's a line of text contained in a <span>, and I'd like it to fade away after 4 seconds. Instead, there is no fade effect, it just disappears after 4 seconds.

    Code:
    <script type='text/javascript'>
    	$(document).ready(function(){
    		setTimeout(function(){
    			$('#success').fadeOut('slow'); 
    			}, 4000);		
    	});
    </script>
    Last edited by BlackAce; January 10th, 2013 at 06:02 PM.
  2. #2
  3. A Not To Shabby Code Smurf
    Devshed Beginner (1000 - 1499 posts)

    Join Date
    Aug 2008
    Posts
    1,156
    Rep Power
    183
    Originally Posted by BlackAce
    EDIT: Nevermind, apparently fadeOut cannot be applied to a span, since it worked when I changed it to <p>.
    It might be because you do not have the <span> element set to a block level element, as it is a inline element by default. The <p> element is a block level element by default. This is just a guess; but you might could set the <span> element to a block level element and it may fade out, as well.

    Comments on this post

    • Kravvitz agrees
    • BlackAce agrees : You are absolutely correct.

IMN logo majestic logo threadwatch logo seochat tools logo