javascript - jQuery image src fadeOut fadeIn effect -
i have problem code. not work. process ends on fadinout image. i'm beginner in js.
the code:
$(".intro_lg").click(function() { $(".intro_lg").fadeout(1000, function() { var path = "http://website.com/img/intro2.png"; $(".intro_lg").attr("src", path); }).fadein(1000); return false; });
you can try running code when page ready using .ready()
:
$(document).ready(function() { $(".intro_lg").click(function() { $(this).fadeout(1000, function() { var path = "http://website.com/img/intro2.png"; $(this).attr("src", path); }).fadein(1000); return false; }); });
and rather repeating selectors, use this
instead.
Comments
Post a Comment