how to create drop down button like gmail "move to" button?
i have a simple file upload system coded in php.
As part of increasing the UI simplicity, i want to have a similar gmail "Move To" button where I can check multiple checkboxes and then after clicking one of the many possible entries in the drop down generated by the button, some postback takes place.
Ple开发者_开发百科ase advise.
Thank you.
Ideally, would be to use jQuery. though i am not an expert, i have some small experience using jQuery.
I use jQuery Multiselect to do something similar.
A bit late but there is my button with drop down option list solution using JQuery UI:
Working solution in jsfiddle
html:
<button id="menuButton">Menu Button</button>
<ul style="z-index: 9999999;position: absolute;" id="menuElement">
<li><a href="#">Select Green</a>
</li>
<li><a href="#">Select Red</a>
</li>
<li><a href="#">Select Gray</a>
</li>
</ul>
code:
var $menuButton = $("#menuButton");
var $menuElement = $("#menuElement");
$menuButton
.button({
icons: {
secondary: "ui-icon-triangle-1-s"
}
})
.click(function (event)
{
$(document).one("click", function ()
{
$menuElement.css("visibility", "hidden");
});
$menuElement.css("visibility", "visible");
event.stopPropagation();
});
$menuElement
.menu({
select: function (event, ui)
{
$menuElement.css("visibility", "hidden");
}
})
.css("visibility", "hidden")
.position({
my: "left top",
at: "left bottom",
of: $buttonElement
});
精彩评论