Advanced User Interface Controls and Components
Created: 07 April 2014
In general Accordion is a widget containing of groups with headers and content panels which expands its content vertically. IntegralUI Accordion extends this further allowing to horizontally expand the content of groups. In following section we will describe this feature in more details.
Vertical Expansion |
Horizontal Expansion |
There are two ways to allow groups to expand its content horizontally, by setting the expandDirection to:
$(document).ready(function() {
// Create an instance of Accordion widget
var $bar = $('#accordion').accordion({
expandDirection: 'right',
hoverSelection: true
});
});
Using code above, the accordion will expands its content from left to right, when mouse cursor hovers over group header.
Related: Inline Expand in Accordion jQuery
By default the content of group headers, caption or custom content, is displayed horizontally. We can also show header displayed vertically while its content panel remains expanding horizontally. This is done by chaining the headerContentOrientation property:
// Create the content of group panel
var generateGroupContent = function(){
return "<div class='group-content marker-left'><a href=''>read more</a>Lorem ipsum dolor sit amet ... </div>";
}
In vertical expansion, each group can expand its content either downwards or upwards. To enable this we are using the expandDirection property, with following values:
// Create an instance of Accordion widget
var $bar = $('#accordion').accordion({
expandDirection: 'up'
});
Using code above, the accordion will expands its content upwards whenever group header is clicked. Expanding while mouse cursor hovers over group header is disabled.
Here is a link to a demo which shows Changing of Expand Direction in Accordion jQuery.