Bug Tracker

Opened 11 years ago

Closed 11 years ago

#4030 closed bug (invalid)

Show method callback not working properly

Reported by: pareshvarde Owned by:
Priority: major Milestone: 1.3.2
Component: unfiled Version: 1.3.1
Keywords: Show effect Cc:
Blocked by: Blocking:

Description

here is my code:

function showProfile(id) {

$('#profile_' + id).show("slow", hideAllProfile(id));

}

function hideAllProfile(id) {

$(".profilePopup:not(#profile_" + id + ")").hide();

}

I have series of DIVs in my content. I want to make sure that I am opening a second divs it should close all others. Hence on call back of show methods I am calling "hideAllProfile" to hide all other divs. However this is not giving me expected result. This results in multiple DIVs being opened on my page.

Change History (1)

comment:1 Changed 11 years ago by dmethvin

Resolution: invalid
Status: newclosed

When you say hideAllProfile(id) you are executing the function immediately. The easiest way to pass a parameter is via a closure:

function showProfile(id) {
   $('#profile_' + id).show("slow", function(){
      $(".profilePopup:not(#profile_" + id + ")").hide();
   });
}

If you need further help with jQuery, please ask on one of the jQuery forums rather than opening a bug report.

Note: See TracTickets for help on using tickets.