In a nutshell, my issue is this: I am looking to create split-buttons with a menu inside (achieved using jquery-ui as shown here: jqueryui-demo). However, I want these buttons to not impact the positioning of other elements. The second button should remain in place even when the first split-button expands its menu, which is currently not the case as demonstrated in this jsfiddle. While I understand that changing the position attribute in the CSS to absolute might be a solution, I prefer not having to manually calculate and adjust positions whenever changes occur.
Is there a way to instruct jquery.menu to overlay my menu?
The gist of the jsfiddle problem can be summarized as follows:
JavaScript
$(function () {
$.each($(".key"), convert);
});
function convert(index, element) {
//retrieve button-value
var key = $(element).text();
//exchange elements html with the split-button and the menu
$(element).html(
'<div><div><button class="KeywordTag">' + key + '</button>
<button class="selectButton">Options</button></div>
<ul>
<li><a href="#" class="addtoquery">Add to Query</a></li>
<li><a href="#" class="opentab">Open in new Tab</a></li>
<li><a href="#" class="addtoquerytab">Add to Query in new Tab</a></li>
</ul></div>');
//call jquery.button(...) to turn the buttons into good looking buttons the the
//unordered list into a menu
//...
//add event handling
//...
}
CSS
//for round borders...
//I'd probably need to change the position attribute, but I really don't want to
//have to calculate each position by hand...
.KeywordTag {
-moz-border-topleft-radius: 75px;
-moz-border-bottomleft-radius: 75px;
-webkit-border-topleft-radius: 75px;
-webkit-border-bottomleft-radius: 75px;
border-bottom-left-radius:75px;
border-top-left-radius:75px;
}
.selectButton {
-moz-border-topright-radius: 75px;
-moz-border-bottomright-radius: 75px;
-webkit-border-topright-radius: 75px;
-webkit-border-bottomright-radius: 75px;
border-bottom-right-radius:75px;
border-top-right-radius:75px;
}
HTML
<!-- Those spans will be exchanged with
the actual buttons and menus by the javascript above -->
<span class="key">examplekey</span>
<span class="key">examplekey2</span>