Search code examples
jqueryanimationjquery-eventsdom-manipulation

jQuery - .append() with .fadeIn() not working


I am having some trouble getting this working:

$("#cloud1").live("mouseenter", function() {
$(this).append('<div class="cloud1"><img src="http://mercury-consulting.theportlandco.com/wp-content/uploads/2010/10/1.png" width="470" height="400"/></div>');
$(this).fadeIn('slow');
});

Its not fading in when I hover over the div, it just appears. Not sure what the issue it - please let me know!


Solution

  • Your element is already visible. Try this example

    $("#cloud1").live("mouseenter", function() {
       $(this).append('<div class="cloud1" style="display:none"><img src="http://mercury-consulting.theportlandco.com/wp-content/uploads/2010/10/1.png" width="470" height="400"/></div>')
        .find('div.cloud1').fadeIn('slow');
    });