popupmenu.js

popupmenu.js is a simple JavaScript popup menu library. This library doesn't need any other libraries.
This works on IE and Firefox(doesn't work on Opera).

download

popupmenu.js

examples

example1

var popup1 = new PopupMenu();
popup1.add('open new window', function(target) {
    window.open(location.href);
});
popup1.add('alert', function(target) {
    alert('alert!');
});
popup1.addSeparator();
popup1.add('close', function(target) {
    window.close();
});
popup1.setSize(140, 0);
popup1.bind('example1'); // target is this pre block
/* popup1.bind(); // target is document */

example2

var popup2 = new PopupMenu();
popup2.add('red', function(target) {
    target.style.background = 'red';
});
popup2.add('blue', function(target) {
    target.style.background = 'blue';
});
popup2.add('yellow', function(target) {
    target.style.background = 'yellow';
});
popup2.addSeparator();
popup2.add('default', function(target) {
    target.style.background = '#EEE';
})
popup2.setSize(150, 0);
popup2.bind('example2'); // target is this pre block

license

The modified BSD license.