I am working on a mobile website and using jquerymobile. I have 4 collapsible items in an accordion. I want to have one of the items to stay expanded. If i click the expanded item, it is collapsed (i do not want to collapse this item). If i click any other collapsed item, the last expanded item is collapsed (thats ok).
I will appreciate your help. The dynamic javascript code for accordion categories is given bellow:
function create-accordion(categories)
{
category_array = categories;
jQuery.each(categories, function( index, value )
{
var div = '<div data-role="collapsible" class="custom-collapsible" ';
if(index == 0)
div += 'data-collapsed="false"';
div += '>';
div += '<h3 style:"padding:0px; margin:0px;"> ' + value.name + '</h3>\
<div class= "collapsable-limit-theme">\
<div data-role="content" style="padding:0px; margin:0px;">\
<div class="ui-grid-c, Grid" id="Grid' + value.id + '">\
</div>\
</div>\
</div>\
</div>';
$($('#accord'), this).append(div);
});
$( "#accord" ).collapsibleset( "refresh" );
}
and the html code
<div id="accord" data-role="collapsible-set" border-radius="0px" >
</div>
Regards