Friday, 15 August 2014

javascript - How to open and collapse the accordion Jquery with single click -


Trying to open and collapse the Ardi on a single click. I am able, but when I select another equation, then it is shutting down.

It should be chosen or stopped in the same parallelism.

This is what I have done.

JS:

  $ (document) .on ("click", ".accordion-toggle", function () {if ($ (this) .attr ( 'Class') .indexOf ('open') == -1) $ (this) .toggleClass ("Open") Next SlideToggle ('sharp'); // Hide other panels $ ("Accordion ($ (This)). Remove class ("open"), $ (". Accordion-content"). ($ (This) .next ()). SlideUp ('sharp'); });  

body:

I made a new bela with something CSS is ...

HTML

  & lt; Div class = "accordion-container" & gt; & Lt; A href = "#" class = "Ederion-Toggle" & gt; Title 1 & lt; / A & gt; & Lt; Div class = "accordion-content" & gt; Content 1 & lt; / Div & gt; & Lt; / Div & gt; & Lt; Div class = "avionian-container" & gt; & Lt; A href = "#" class = "accordion-toggle" & gt; Title 2 & lt; / A & gt; & Lt; Div class = "accordion-content" & gt; Content 2 & lt; / Div & gt; & Lt; / Div & gt; & Lt; Div class = "avionian-container" & gt; & Lt; A href = "#" class = "Ederion-Toggle" & gt; Title 3 & lt; / A & gt; & Lt; Div class = "accordion-content" & gt; Content 3 & lt; / Div & gt; & Lt; / Div & gt;  

js

  $ (document) .ready (function () {$ ('. Accordion-toggle'). ('Click', function (Event) {event.preventDefault (); // accordion variables var accordion = $ (this); var accordionContent = accordion.next ('.eaparian-content'); // toggle accordion link open class accordion.toggleClass ("open "); // Toggle Emergence content Adrian content. Slide toggle (250);});});  

Please check this


No comments:

Post a Comment