en.javascript.info/2-ui/5-widgets/2-widgets-structure/menu.view/menu.js
2015-02-18 21:23:40 +03:00

12 lines
232 B
JavaScript

function Menu(options) {
var elem = options.elem;
elem.onmousedown = function() { return false; }
elem.onclick = function(event) {
if (event.target.closest('.title')) {
elem.classList.toggle('open');
}
};
}