Reputation: 1
developed a webapp using dhtmlx 5.0 and wijmo grid. the app works fine when used in chrome(android). the context menu is opened with touch-'press and hold' but the same thing doesn't work when used in safari browser of iphone. The context menu doesn't open with any touch event in iphone. Please help with the events or library whatever required to make it work.
Upvotes: 0
Views: 93
Reputation: 504
Please, try to simulate your own longPress with the following code:
var timer;
function onlongtouch(x,y){
timer = null;
myContextMenu.showContextMenu(x, y);
}
function touchstart(e) {
var x = e.touches[0].clientX
var y = e.touches[0].clientY
if (!timer) {
timer = setTimeout(function(){onlongtouch(x,y)}, 800);
}
}
function touchend() {
if (timer) {
clearTimeout(timer);
timer = null;
}
}
document.addEventListener("DOMContentLoaded", function(event) {
window.addEventListener("touchstart", touchstart, false);
window.addEventListener("touchend", touchend, false);
});
Here is a working example: http://snippet.dhtmlx.com/5/f0a993511
Upvotes: 0