Question

I have the following code where I am trying to find out how to use the events to close the collapsible sets in the panel whenever the panel closes. I have included an example in jfFiddle at the following link http://jsfiddle.net/rLjBB/4/ as well as included the code below. I need some help on understanding how to approach the use of events using jQuery Mobile framework. I am a beginning when it comes to this library so any assistance would be appreciated.

<body>

<div data-role="page" id="MuseMain">

    <div data-role="panel" id="leftmenupanel">

        <div data-role="collapsible-set" data-collapsed="true">
            <div  data-role="collapsible" data-theme="b" data-content-theme="d" >
                <h3>Overview</h3>
                <p>The overview provides what is normally seen on a book cover; the    name, author and description of the story.</p>
                <a href="" data-role="button" data-mini="true" data-icon="edit" data-inline="true" data-theme="a">Edit</a>
            </div>
        <div  data-role="collapsible" data-theme="b" data-content-theme="d" >
            <h3>Chapters & Scenes</h3>
            <p>The chapters are where the details of the chapters are defined and the actual storyline scenes are created..</p>
            <a href="" data-role="button" data-mini="true" data-icon="edit" data-inline="true" data-theme="a">Edit</a>
        </div>
        <div  data-role="collapsible" data-theme="b" data-content-theme="d" >
            <h3>Characters</h3>
            <p>The characters area is very detailed and allows the attributes to be defined, a detailed description, personality type, and relationships.</p>
            <a href="" data-role="button" data-mini="true" data-icon="edit" data-inline="true" data-theme="a">Edit</a>
        </div>


    </div>

</div><!-- /panel -->

<div data-role="header">

    <a href="#leftmenupanel" id="changeIconValue" data-role="button" data-icon="bars" data-theme="b" data-inline="true">Menu</a>

    <h1>Muse - A Writer's Assistant</h1>

</div>

<div data-role="content">

    <h2>Page content</h2>
    <p>Page content goes here.</p>

</div>
<div data-role="footer">
    <h1>Design By IntelligentDesigns</h1>
</div>

 </body>
Was it helpful?

Solution

This solves your problem:

$('#leftmenupanel').panel({
    close: function( event, ui ) {
        $('#leftmenupanel div[data-role="collapsible"]').trigger('collapse');
    }
});

I added it to an updated fiddle: http://jsfiddle.net/rLjBB/5/

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top