Jump to content
Killersites Forums

Jqueary Accordian


Recommended Posts

Hi Folks! Been awhile.

 

I have an issue with this script. Basically, I have a class set to be on by default shoping the 'plus' icon image and the script is suppose to remove the class and display the 'minus' icon image when one of the four panels open. It does that fine but it removes the class for all four panels even though I am opening just one. Additionally, when I close the panel it's suppose to add back the class but it doesn't.

 

js is not my strong point. Any help would be greatly appreciated.

 

The url: 96.125.177.153/sto re/pc/viewCa tegories.asp?idCategory=9 (remove two spaces)

 

The script:



$(document).ready(function() {

//ACCORDION BUTTON ACTION (ON CLICK DO THE FOLLOWING)
$('.accordionButton').click(function() {

	//REMOVE THE ON CLASS FROM ALL BUTTONS
	$('.accordionButton').removeClass('on');

	//NO MATTER WHAT WE CLOSE ALL OPEN SLIDES
 	//$('.accordionContent').slideUp('normal');

 	//KEEPS ONE OR MORE SLIDE OPEN UNTIL CLICKED OR PAGE RELOAD - must comment out line 21 to work
/* */
 	if($(this).next().is(':visible')) {
		$(this).next().slideUp('normal');
	 } else {	
		$(this).next().slideDown('normal');
	}
/* */


	//IF THE NEXT SLIDE WASN'T OPEN THEN OPEN IT
	if($(this).next().is(':hidden') == true) {

		//ADD THE ON CLASS TO THE BUTTON
		$(this).addClass('on');

		//OPEN THE SLIDE
		$(this).next().slideDown('normal');
	 } 

 });


/*** REMOVE IF MOUSEOVER IS NOT REQUIRED ***/

//ADDS THE .OVER CLASS FROM THE STYLESHEET ON MOUSEOVER 
$('.accordionButton').mouseover(function() {
	$(this).addClass('over');

//ON MOUSEOUT REMOVE THE OVER CLASS
}).mouseout(function() {
	$(this).removeClass('over');										
});

/*** END REMOVE IF MOUSEOVER IS NOT REQUIRED ***/	

/********************************************************************************************************************
CLOSES ALL S ON PAGE LOAD
********************************************************************************************************************/	
$('.accordionContent').hide();

});




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.
Note: Your post will require moderator approval before it will be visible.

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...