Jump to content
iwato

jQuery's slideToggle( ) Extrapolation

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

Share this post


Link to post
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

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...

×
×
  • Create New...