Issue
Following jquery is not working in my android webview. When long press on a span for more than 10 seconds it needs to be redirected to a specific url, this is working on site but not working on android webview.
$(function() {
var longpress = 10000;
var start;
jQuery("#restart").on('mousedown', function(e) {
start = new Date().getTime();
});
jQuery("#restart").on('mouseleave', function(e) {
start = 0;
});
jQuery("#restart").on('mouseup', function(e) {
if (new Date().getTime() >= (start + longpress)) {
alert('long press!');
$("#restart >a").attr("href", "http://siteurl/?key=gesture")
} else {
alert('short press!');
}
});
});
Solution
Are you using a touchscreen? If so you may need to use 'touchstart' and 'touchend'
Answered By - AnthW
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.