javascript - jquery fading in from full opacity to 0.2 -
when page loads span overlay fade in full #000 opacity 0.2 , stay @ 0.2 when hover goes opacity 0
this code have @ moment
$(function () { $('ul li a').append('<span id="load"></span>'); $('span').css('display', 'block').fadeout(3400); $('span') .animate ({ "opacity" : .2 }); $('span') .hover(function() { $ (this) .animate ({"opacity": 0}); }, function () { $(this).stop() .animate ({"opacity": .2 }); }); });
here example
something this?
$(function () { var animateduration = 2000; /* no-no since should use id single element on page - should use class instead */ $('ul li a').append('<span id="load"></span>'); /* i'm not sure understood correctly, sounds want like: */ $('span').css({ display:'block', opacity: 0.9 }).animate({ opacity: 0.2 }, animateduration); /* causes element have opacity 0f 0.9 when page loads , start animating opacity 0.2 */ $('span') .hover(function() { $ (this) .animate ({"opacity": 0}, animateduration); }, function () { $(this).stop() .animate ({"opacity": .2 }, animateduration); }); });
Comments
Post a Comment