[英]JQuery/Javascript popup dismiss before download on anchor tag
I have a file that can be downloaded onto mobile phones on my mobile website. 我的文件可以在手机网站上下载到手机上。 Now the file can be downloaded by simply clicking on an anchor tag.
现在,只需单击锚标记即可下载文件。 Now I want to display a javascript popupbox with some important info before the download is started, and before you can initiate the download, you must dismiss the popup box(by just clicking agree/ok...) or just by clicking on another 'Download Now' button.
现在,我想在开始下载之前显示一个包含一些重要信息的javascript弹出框,并且在开始下载之前,必须关闭弹出框(只需单击“同意/确定...”)或单击另一个“立即下载”按钮。 how do I do that?
我怎么做?
My attempt: As you can see in my JSFiddle , I'm not sure how to initiate the file download once clicking on the 'Download Now' button. 我的尝试:正如您在我的JSFiddle中所看到的那样 ,一旦单击“立即下载”按钮,我不确定如何启动文件下载。
I think plain javascript might be better since I'm not sure including a jquery file into a mobile site is always the best thing, especially for mobiles with slow internet connections...but jquery will also do for now Thank You 我认为普通的javascript可能会更好,因为我不确定将jquery文件包含到移动网站中始终是最好的选择,尤其是对于互联网连接速度较慢的手机...但是jquery现在也可以这样做谢谢
try the following jquery: @bingjie: Which one do you think will be better? 尝试以下jquery:@bingjie:您认为哪一个更好? Mine or yours?
我的还是你的?
$(document).ready(function(){
$("#dialog-download ").dialog({
autoOpen: false,
resizable: false,
height: 140,
width: 325,
modal: true
});
$(".opener").click(function(){
var that = this;
$("#dialog-download").dialog("option", {buttons: {
"Download Now": function(){
$("a").attr("href", "http://dl.v4m.mobi/bb/2012_07_10/OS-v5.0up/e_phone.jad");
window.location.href = $('#myClass').attr('href');
}
}
});
$("#dialog-download").dialog("open");
});
});
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.