vendredi 27 février 2015

How to make a download link also activate modal pop up message?

first time asker here.


I'm trying to make a download button not only serve the file download but also cause a modal pop up to be activated giving the user simple instructions on downloading the file.


I'm using what I've researched online as this:





.modalDialog {
position: fixed;
font-family: Arial, Helvetica, sans-serif;
top: 0;
right: 0;
bottom: 0;
left: 0;
background: rgba(0, 0, 0, 0.8);
z-index: 99999;
opacity: 0;
-webkit-transition: opacity 400ms ease-in;
-moz-transition: opacity 400ms ease-in;
transition: opacity 400ms ease-in;
pointer-events: none;
}
.modalDialog:target {
opacity: 1;
pointer-events: auto;
}
.modalDialog > div {
width: 400px;
position: absolute;
bottom: -125px;
left: 10px;
margin: 10% auto;
padding: 5px 20px 13px 20px;
border-radius: 10px;
/*background: #fff;
background: -moz-linear-gradient(#fff, #999);
background: -webkit-linear-gradient(#fff, #999);
background: -o-linear-gradient(#fff, #999);*/
}



<div id="openModal" class="modalDialog">
<div>
<a href="#close" title="Close" class="close">X</a>
<img src="http://ift.tt/1ABLuSc" />
</div>
</div>

<a href="#openModal" onclick="window.open('pathtodownloadfile');" class="download-now">Download</a>



It works in that it causes the modal pop up to activate, and it opens a new tab for the file to be served from.


Is there any way to do this so that the file can be served without opening a new window? I've seen sites have a download button where when pressed, a small instructional modal pop up occurs and helps the user to download/install the file all within the same page, no second window needed..


What am I missing?


Aucun commentaire:

Enregistrer un commentaire