鼠标向上,鼠标向下在android webview中不起作用 [英] mouseup, mouse down not working in android webview

查看:51
本文介绍了鼠标向上,鼠标向下在android webview中不起作用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

以下 jquery 在我的 android webview 中不起作用.当长按跨度超过 10 秒时,它需要重定向到特定的 url,这在网站上有效,但在 android webview 上无效.

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!');
    }
  });
});

推荐答案

您使用的是触摸屏吗?如果是这样,您可能需要使用touchstart"和touchend"

Are you using a touchscreen? If so you may need to use 'touchstart' and 'touchend'

这篇关于鼠标向上,鼠标向下在android webview中不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆