I'm having some difficulty with writing some jQuery code. What i'm trying to do is pass multiple methods through an event handler like so $(foo).click(methodOne , methodTwo); The purpose of the first method is to fade out the current view and then hide it and the purpose of the second method is to display an alternate view. For whatever reason click is only accepting one method, and I'm quite positive that it can accept at least 2. Here is the code:
$(document).ready(function(){
$("#slide1").hide();
$(".items img").click(function() {
if ($(this).hasClass("active")) { return; }
$(".items img").removeClass("active");
$(this).addClass("active");
$(".slide1").click(fadeOut,showSlide1);
$(".slide0").click(fadeOut,showSlide0);
});
});
function fadeOut() {
$(this).stop().fadeTo("medium", 0);
$(this).hide();
}
//Slide 0 has been clicked
function showSlide0(){
$("#slide0").stop().fadeTo("medium", 1);
}
//Slide 1 has been clicked
function showSlide1(){
$("#slide1").stop().fadeTo("medium", 1);
}