user3755380
user3755380

Reputation:

Accordion Jquery collapse up onClick

I have a accordion, on click of which I want the accordion should collapse UP, now it is collapsing down. Any help. See my code below:-

<link rel="stylesheet" href="//code.jquery.com/ui/1.11.2/themes/smoothness/jquery-ui.css" />
<script src="//code.jquery.com/jquery-1.10.2.js"></script>
<script src="//code.jquery.com/ui/1.11.2/jquery-ui.js"></script>
<link rel="stylesheet" href="/resources/demos/style.css" />
<script>
    $(function () {
        $("#accordion").accordion({
            header: "h3",
            collapsible: true,
            active: false
        });
    });
</script>

Also see the HTML code for the same:-

 <div id="accordion">
      <h3>Section 4</h3>
            <div>
                <p>
                    Cras dictum. Pellentesque habitant morbi tristique senectus et netus
et malesuada fames ac turpis egestas. Vestibulum ante ipsum primis in
faucibus orci luctus et ultrices posuere cubilia Curae; Aenean lacinia
mauris vel est.
                </p>
                <p>
                    Suspendisse eu nisl. Nullam ut libero. Integer dignissim consequat lectus.
Class aptent taciti sociosqu ad litora torquent per conubia nostra, per
inceptos himenaeos.
                </p>
            </div>
        </div>
    </div>

Upvotes: 2

Views: 400

Answers (1)

Billy
Billy

Reputation: 2448

could just rotate them with css

.accordion{transform:rotate(180deg);}
.accordion h3,.accordion div{transform:rotate(180deg);}

jsfiddle

Upvotes: 1

Related Questions