kin*_*sch 7 javascript android ios web callout
我想知道是否有可能使用Javascript在iOS和Android上触发"保存图像"触摸标注.标注是由长按触发的,但即使我尝试模拟它,它也不起作用.
我想实现这样的事情:
jQuery('img').openCallout();
Run Code Online (Sandbox Code Playgroud)
到目前为止我试过这个:
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
}
});
Run Code Online (Sandbox Code Playgroud)