Bind expaned and collapse event handler on collapsible
Description
The following code shows how to bind expaned and collapse event handler on collapsible.
Example
<!--from ww w .j av a2s . c o m-->
<!DOCTYPE html>
<html>
<head>
<script type='text/javascript'
src='http://code.jquery.com/jquery-1.6.4.js'></script>
<link rel="stylesheet" type="text/css"
href="http://code.jquery.com/mobile/1.0/jquery.mobile-1.0.min.css">
<script type='text/javascript'
src="http://code.jquery.com/mobile/1.0/jquery.mobile-1.0.min.js"></script>
</head>
<body>
<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>
<script type='text/javascript'>//<![CDATA[
function expand() {
alert('Expanded');
$(this).unbind('expand', expand);
}
function collapse() {
alert('Collapsed');
}
$('#my-collaspible').bind({
'expand': expand,
'collapse': collapse
});
//]]>
</script>
</body>
</html>