Add on-mouseup and on-mousedown processing
This commit is contained in:
parent
408e0963a0
commit
354a3d9f09
|
@ -126,6 +126,28 @@ function dataOnClick() {
|
||||||
window[fnName](ev);
|
window[fnName](ev);
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
|
document.querySelectorAll("button[data-on-mousedown]").forEach(function(el) {
|
||||||
|
var fnName = el.getAttribute("data-on-mousedown");
|
||||||
|
if ( !window[fnName] ) {
|
||||||
|
console.error("Nothing found to bind to " + fnName + " on element " + el.name);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
el.onmousedown = function(ev) {
|
||||||
|
window[fnName](ev);
|
||||||
|
};
|
||||||
|
});
|
||||||
|
document.querySelectorAll("button[data-on-mouseup]").forEach(function(el) {
|
||||||
|
var fnName = el.getAttribute("data-on-mouseup");
|
||||||
|
if ( !window[fnName] ) {
|
||||||
|
console.error("Nothing found to bind to " + fnName + " on element " + el.name);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
el.onmouseup = function(ev) {
|
||||||
|
window[fnName](ev);
|
||||||
|
};
|
||||||
|
});
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue