View Full Version : Need to change it from fadeTo to fadeIn

07-26-2014, 11:33 AM
How can I change it from fadeTo to fadeIn? Just changing it to fadeIn didn't do the trick. I'd like for an image to fade in slowly on click.

$(function() {
$(".items img").click(function() {
if ($(this).hasClass("active")) { return; }
var url = $(this).attr("src").replace("_t", "");
var wrap = $("#image_wrap").fadeTo("medium", 0.5);
var img = new Image();
img.onload = function() {
wrap.fadeTo("fast", 1);
wrap.find("img").attr("src", url);
img.src = url;
$(".items img").removeClass("active");

07-27-2014, 06:59 AM
Assuming you are using JQuery
$("#image_wrap img").fadeIn(400);

However if there is an example somewhere like a page then please post it