Jump to content

jQuery's slideToggle( ) Extrapolation


iwato

Recommended Posts

BACKGROUND:  The following piece of code is a little tricky, because it requires insight into more than what is shown.  So, please allow me to show and tell, rather than only tell, and invite you to click on the menu option Sponsor Overview under the subheading Visitor Profile in the navigation bar of the Grammar Captive mainpage.  Once arrived click on either of the two items entitled Visits per Number of Pages or Visits per Time Spent and then click again on the same item.  What shows and what disappears are different.

Now, I well understand why this occurs, but everything that I have tried to correct for it has failed.  Indeed, I would like the toggle to effectuate a complete disappearance of both explanation and data, rather than just the explanation.

The CODE

$(".so_clarify, #visits_per_number_pages, #visits_per_duration").css('margin', '1em 0').hide();
$(".so_param").mouseenter(function() {
    $(this).css({"cursor":"pointer","font-weight": "800","color":"#ffffff"});
});
$(".so_param").click(function(event) {
    var index = $(".so_param").index(this);
    $(".so_clarify").eq(index).slideToggle(function() {
        if (index == 8) {
            $("#visits_per_number_pages").show();
        } else if (index == 9) {
            $("#visits_per_duration").show();
        }	
    });
});
$(".so_param").mouseout(function() {
    $(this).css({"cursor":"none","font-weight": "normal","color":"#fadb9d"});
});	

Roddy

Link to comment
Share on other sites

Never mind.  I got it.

.show() => .slideToggle(0

It was so easy!  No wonder, I could not figure it out.

Roddy

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...