I am just learning how to define a function and call it back later. I am stuck trying to define 'this' in my function without using an event.
function slide() {
var imgAlt = $(this).find('img').attr("alt");
var imgTitle = $(this).find('a').attr("href");
var imgDesc = $(this).find('.block').html();
var imgDescHeight = $(".main_image").find('.block').height();
$(.active);
$(".main_image .block").animate({ opacity: 0, marginBottom: -imgDescHeight }, 250 ,
function() {
$(".main_image .block").html(imgDesc).animate({ opacity: 0.85, marginBottom: "0" }, 250 );
$(".main_image img").attr({ src: imgTitle , alt: imgAlt});
}
);
}
});
On line 6 you will see '$(.active); ' and this is where I want to select the class active and then apply the following function to it. Normally I used to setting this up on a click or something so I am unsure how to impliment it.
Any help greatly appreciated! Thanks
Here is a js fiddle where you can see the big picture: http://jsfiddle.net/wzQj6/21/