Hi all
I have a HTML Button (div) and i want to create a touch event on it.
At the moment the tap/click works only if I click on the screen NOT the button.
It’s clearly because of this.app.touch.on(“touchstart”, this.onTouchDown, this);
How can I change this, so “TouchDown” starts when i only press the HTML Button?
Any ideas?
The code from this project did not work for me https://playcanvas.com/project/354600/overview/htmlcss--live-updates
And I can’t get the div with: var button = this.element.querySelector(’#ButtonUp’);
THX
Button.prototype.initialize = function() {
// create DIV element
var div = document.createElement(“div”);
this.element = div;
div.id = “ButtonUp”;
div.innerHTML = this.html.resource;
document.body.appendChild(div);
style = pc.createStyle(this.css.resource); document.head.appendChild(style); this.app.touch.on("touchstart", this.onTouchDown, this);
};
Button.prototype.onTouchDown = function() {
console.log(“clicked”);
// Do STUFF
};