Advanced User Interface Controls and Components
Occurs before group becomes expanded.
Param | Type | Details |
---|---|---|
e | Object | An event object which contains the expanding group |
This event can be handled by binding the 'beforeexpand' event to the Accordion widget object.
Supported in: v1.0.
In this example we are showing how to create a handle to the beforeexpand event in Accordion widget.
By handling this event you can prevent group from expanding depending on some custom conditions. In our example group with text value set to 'Vegetables' cannot expand.
$(document).ready(function() {
// Create an instance of Accordion widget
var $bar = $('#accordion').accordion();
$bar.on({
"beforeexpand": function(e){
if (e.object.text === 'Vegetables')
return false;
});
});
<!DOCTYPE html>
<html>
<head>
<link rel="stylesheet" href="css/integralui.accordion.css" />
<link rel="stylesheet" href="css/themes/theme-blue.css" />
<script type="text/javascript" src="external/jquery-1.9.1.min.js"></script>
<script type="text/javascript" src="external/jquery.ui.core.min.js"></script>
<script type="text/javascript" src="external/jquery.ui.widget.min.js"></script>
<script type="text/javascript" src="js/jquery.integralui.widget.min.js"></script>
<script type="text/javascript" src="js/jquery.integralui.accordion.min.js"></script>
</head>
<body>
<div id="accordion" class="widget">
<h3><span>Fruits</span></h3>
<div></div>
<h3><span>Meat</span></h3>
<div></div>
<h3><span>Vegetables</span></h3>
<div></div>
</div>
</body>
</html>
.widget
{
width: 300px;
height: 300px;
}
A sample which demonstrates how to handle different events in Accordion widget.