Link to download the original media (photos / videos)

pull/9/head
rprieto 10 years ago
parent 37a3c963fc
commit 06b2714fde

@ -101,3 +101,16 @@ nav li:not(.active):hover {
top: 0; top: 0;
width: 100%; width: 100%;
} }
.blueimp-gallery > .download {
position: absolute;
top: 30px;
left: 15px;
color: #fff;
display: none;
text-decoration: none;
}
.blueimp-gallery-controls > .download {
display: block;
}

@ -38,14 +38,16 @@
<div class="video-overlay">&#9654;</div> <div class="video-overlay">&#9654;</div>
<a href="{{urls.web}}" <a href="{{urls.web}}"
type="video/mp4" type="video/mp4"
data-poster="{{urls.large}}"> data-poster="{{urls.large}}"
data-download="{{urls.original}}">
<img src="{{urls.thumb}}" <img src="{{urls.thumb}}"
width="{{size}}" width="{{size}}"
height="{{size}}" height="{{size}}"
alt="{{name}}" /> alt="{{name}}" />
</a> </a>
{{else}} {{else}}
<a href="{{urls.large}}"> <a href="{{urls.large}}"
data-download="{{urls.original}}">
<img src="{{urls.thumb}}" <img src="{{urls.thumb}}"
width="{{size}}" width="{{size}}"
height="{{size}}" height="{{size}}"
@ -58,6 +60,7 @@
<div id="blueimp-gallery" class="blueimp-gallery"> <div id="blueimp-gallery" class="blueimp-gallery">
<div class="slides"></div> <div class="slides"></div>
<h3 class="title"></h3> <h3 class="title"></h3>
<a class="download" href="#" target="_blank" download>Download</a>
<a class="prev"></a> <a class="prev"></a>
<a class="next"></a> <a class="next"></a>
<a class="close">×</a> <a class="close">×</a>
@ -74,9 +77,16 @@
event = event || window.event; event = event || window.event;
var target = event.target || event.srcElement, var target = event.target || event.srcElement,
link = target.src ? target.parentNode : target, link = target.src ? target.parentNode : target,
options = {index: link, event: event},
links = this.getElementsByTagName('a'); links = this.getElementsByTagName('a');
blueimp.Gallery(links, options); blueimp.Gallery(links, {
index: link,
event: event,
onslide: function (index, slide) {
var anchor = this.container.find('.download');
var url = this.list[index].getAttribute('data-download');
anchor[0].href = url;
}
});
}; };
</script> </script>

Loading…
Cancel
Save