in Education by
What I'm trying to achieve is a list of links with some separate divs. at the moment the fading is working but is "jumping on click" and the active in both

1 Answer

0 votes
by
H, I suggest you do this. Also changed from descriptions to classes as the ideal code requires unique ids per page http://jsfiddle.net/mdamC/104/ html
  • 1
  • 2
  • 3
  • 4
  • 5


  • 1
  • 1
  • 1
  • 1
  • 1
  • 2
  • 2
  • 2
  • 2
  • 2
  • 3
  • 3
  • 3
  • 3
  • 3
  • 4
  • 4
  • 4
  • 4
  • 4
  • 5
  • 5
  • 5
  • 5
  • 5
CSS .active{color:red} #description{position:relative} .descriptions{position:absolute; top:0px;} JS $("ul#links li").unbind().bind('click', function(e) { if (e) e.preventDefault(); $(this).toggleClass('active'); $("ul.descriptions").fadeOut(); var index = $(this).index();; $("ul.descriptions").eq(index).fadeIn(); if (!e) e = window.event; e.cancelBubble = true; if (e.stopPropagation) e.stopPropagation(); }, function(e) { $("ul.descriptions").stop().fadeOut(); }); $("ul.descriptions").hide(); if ($(this).next().is(':hidden')) { $(this).next().removeClass('active'); } $('ul#links li').click(function(e) { e.preventDefault(); $('ul#links li').removeClass('active'); $(this).addClass('active'); });

Related questions

0 votes
    What I'm trying to achieve is a list of links with some separate divs. at the moment the fading ... JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Feb 19, 2022 in Education by JackTerrance
0 votes
    What I'm trying to achieve is a list of links with some separate divs. at the moment the fading ... JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Feb 19, 2022 in Education by JackTerrance
0 votes
    I am building a basic RSS reader app that, which the 'story' is clicked, the information for it is displayed in a modal ... .log('Does Not Work!'); Or another way: - overscroll...
asked Jul 30, 2022 in Education by JackTerrance
0 votes
    What I'd like to do is iterate through a navigation's list items, and fade each element in, ... JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Feb 17, 2022 in Education by JackTerrance
0 votes
    I have a sample code: Bank1...
asked Feb 11, 2022 in Education by JackTerrance
0 votes
    I have vertices people, usertype, and location. People has outgoing edges people_location and people_usertype. People ... for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Apr 24, 2022 in Education by JackTerrance
0 votes
    Which of the following case comes under victims' list of an active online attack? (a) Strong password based ... for-Cyber Security:,Cyber Security-Jobs:,Cyber Security Applications...
asked Nov 1, 2021 in Education by JackTerrance
0 votes
    I have an autocomplete that's almost working as I want it to work. The problem that I have is ... JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Feb 19, 2022 in Education by JackTerrance
0 votes
    I have an autocomplete that's almost working as I want it to work. The problem that I have is ... JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Feb 18, 2022 in Education by JackTerrance
0 votes
    I want to fill a jquery array with several names populated from a back end function. This is the ... JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Feb 18, 2022 in Education by JackTerrance
0 votes
    I want to fill a jquery array with several names populated from a back end function. This is the ... JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Feb 18, 2022 in Education by JackTerrance
0 votes
    Bring active dry yeast' from the market. Mix a spoonful of yeast, two spoonfuls sugar with a ... ,Science proposed by,electromagnetic theory engineering physics,Science nptel...
asked Nov 7, 2021 in Education by JackTerrance
0 votes
    Which components are included with Microsoft Azure Active Directory Connect? (1)All the options (2)Health (3)Active Directory Federation Services (AD FS) (4)Sync...
asked Sep 23, 2021 in Technology by JackTerrance
0 votes
    Which actions can you perform with Microsoft Azure Active Directory Connect but not with Microsoft Azure Active Directory ... . (4)Connect to multiple on-premises forests....
asked Sep 23, 2021 in Technology by JackTerrance
0 votes
    Microsoft Azure Active Directory can be integrated with on-premises Active Directory to allow single sign-on. 1. True 2. False...
asked Sep 23, 2021 in Technology by JackTerrance
...