I want to add a slideDown
or slideUp
effect to a div
with data-role='collapsible'
, so it will not open at once but gradually.
I have tried this:
$('#my-collapsible').live('expand', function() {
$('#my-collapsible .ui-collapsible-content').slideDown(2000);
});
$('#my-collapsible').live('collapse', function() {
$('#my-collapsible .ui-collapsible-content').slideUp(2000);
});
But it still opens and closes without delay.
Anyone knows how should I call those slideDown
and slideUp
methods?
Live Example:
JS
$('#my-collaspible').bind('expand', function () {
$(this).children().slideDown(2000);
}).bind('collapse', function () {
$(this).children().next().slideUp(2000);
});
HTML
<div data-role="page">
<div data-role="content">
<div data-role="collapsible" id="my-collaspible">
<h3>My Title</h3>
<p>My Body</p>
</div>
</div>
</div>