I have an Alloy UI Dropdown Component I want to render when a user clicks on one of four buttons - this dropdown should be positioned the left of which button was clicked
var toolsDropdown = new Y.Dropdown({
boundingBox: '#my-div',
trigger: '.option',
hideOnClickOutSide: true,
hideOnEsc: true
}).render();
I would like this Dropdown menu to render wherever the position of the button clicked is (imagine these buttons are displayed in each row of a table)
<div id="my-div">
<div id="container-1">
<button id="options-btn-1" class="option" type="button">Option one</button>
</div>
<div id="container-2">
<button id="options-btn-2" class="option" type="button">Option two</button>
</div>
<div id="container-3">
<button id="options-btn-3" class="option" type="button">Option three</button>
</div>
<div id="container-4">
<button id="options-btn-4" class="option" type="button">Option four</button>
</div>
</div>
I have a listener setup to listen for each button clicked
Y.all('button.option-btn').on('click', displayDropdown);
However I'm having some trouble getting this to function properly (maybe I don't fully understand how Alloy's Dropdown works) - any ideas?
EDIT: I think I might fair better with YUI's Overlay Widget
Overlay is a positionable and stackable widget, which also provides support for the standard module format layout, with a header, body and footer section.
Try this: