簡體   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