oxjs/demos/test/menu.js

72 lines
2.2 KiB
JavaScript
Raw Normal View History

2010-02-04 08:02:23 +00:00
$(function() {
var button = new Ox.Button({
value: "First",
}).css({
position: "absolute",
left: "16px",
2010-02-04 08:05:05 +00:00
top: "16px",
width: "128px"
2010-02-04 08:02:23 +00:00
}).appendTo($("body")),
menu = new Ox.Menu({
element: button,
id: "select",
items: [
{
checked: true,
group: "123",
id: "first",
title: "First"
},
{
checked: false,
group: "123",
id: "second",
title: "Second"
},
{
checked: false,
group: "123",
id: "third",
title: "Third"
},
{},
{
checked: false,
group: "123",
id: "fourth",
title: "Fourth"
},
{
checked: false,
group: "123",
id: "fifth",
title: "Fifth"
},
{
checked: false,
group: "123",
id: "sixth",
title: "Sixth"
}
]
});
button
.click(menu.toggleMenu)
.bind("OxClickMenu", function(event, data) {
button.options({
value: data.value
});
});
$select = $("<select>")
.css({
position: "absolute",
left: "160px",
top: "16px"
})
.appendTo($("body"));
$.each(["First", "Second", "Third"], function(i, v) {
$select.append(
$("<option>").html(v)
);
});
});