javascript - Hover over any paragraph, append div with little message, hover off, it fades out, is this right? -
http://jsfiddle.net/nicktheandroid/3araq/
when p hovered over, #both appended paragraph , centered. when hover off , onto new paragraph, fades out on first p , fades in on hovered p. best way it? later on i'll use allow people click bookmark image, when hover p code below does, when click on p create bookmark paragraph, need code below. thanks!
$('p').hover(function() { $(this).append('<span id="both">bookmark this</span>') $('#both').animate({opacity: 1.0}) }, function(){ $('#both').fadeout(600, function(){ $(this).remove() }) });
it's not working smoothly, it's not right....
just use class instead of id:
$('p').hover(function() { $(this).append('<span class="both">bookmark this</span>') $('.both').animate({opacity: 1.0}) }, function(){ $('.both').fadeout(600, function(){ $(this).remove() }) });
Comments
Post a Comment