繁体   English   中英

触发iOS / android上的触摸标注

[英]Trigger touch callout on iOS/android

我想知道是否有可能使用Javascript在iOS和Android上触发“保存图像”触摸标注。 标注是由长按触发的,但即使我尝试模拟它,它也不起作用。

我想实现这样的事情:

jQuery('img').openCallout();

到目前为止我试过这个:

jQuery: jQuery('img').contextmenu();
jQuery Mobile: jQuery('img').taphold();

在此输入图像描述

是的, 可以使用文档中提到的jquery mobile ,使用taphold事件。( 其他事件,我没有尝试

如在该示出的小提琴 (到目前为止在下文测试如图此处

$(function() {
  $("div.box").bind("taphold", tapholdHandler);

  function tapholdHandler(event) {
    alert('Do you want to save the image or however it works in ipad');
    var a = document.createElement('a');
    a.href = "http://i.imgur.com/JzdY53y.jpg";
    a.download = 'JzdY53y.jpg';
    alert("goes till here1"); // just a check
    a.click();
    alert("goes til here 2"); //just a check
  }
});

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM