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",
2010-02-04 08:06:56 +00:00
width: "64px",
textAlign: "left"
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"
}
]
});
2010-02-04 09:50:45 +00:00
button.click(menu.toggleMenu)
Ox.Event.bind("OxClickMenu", function(event, data) {
button.options({
value: data.value
2010-02-04 08:02:23 +00:00
});
2010-02-04 09:50:45 +00:00
});
2010-02-04 08:02:23 +00:00
$select = $("<select>")
.css({
position: "absolute",
left: "160px",
top: "16px"
})
.appendTo($("body"));
$.each(["First", "Second", "Third"], function(i, v) {
$select.append(
$("<option>").html(v)
);
});
});