Expand Panel on Hover
Menu 1
To programmatically change which event(s) open panels after initial setup:
$("selector").accordion("option", "event", "desiredEvent1 desiredEvent2");
Menu 2
The panels in this menu immediately expand upon mousing over their header. This can result in a poor user experience as accidentally mousing over headers instantly expands the new panel. hoverintent is suggested to avoid this issue as it puts a delay on activation by checking mouse velocity. An example with hoverintent can be found here.
Code
Note: hoverintent is more user friendly than mouseover.
An example using hoverintent can be found -here-
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link type="text/css" rel="stylesheet" href="http://code.jquery.com/ui/1.10.4/themes/cupertino/jquery-ui.css"/>
<script type="text/javascript" src="http://code.jquery.com/jquery-1.10.2.min.js"></script>
<script type="text/javascript" src="http://code.jquery.com/ui/1.10.4/jquery-ui.min.js"></script>
<script type="text/javascript">
// $(function() { code }); executes the contained code when the DOM is finished loading
$(function()
{
$("#example").accordion( // Call the accordion method on the element with the id example
{
event: "mouseover" // Set the events that trigger expanding the panel
});
});
</script>
</head>
<body>
<div id="example">
<h3>Menu 1</h3>
<p>This is some placeholder content in a p element.</p>
<h3>Menu 2</h3>
<p>This is more placeholder content in a second p element.
It is coded directly below an h element which jQuery's
accordion method turns into the header you see above this content.
</p>
<h3>Code</h3>
<pre> *** This is what you are viewing *** </pre>
</div>
</body>
</html>