2016-12-20 00:36:18 +08:00
|
|
|
function initPreviewModal() {
|
|
|
|
$('.image-preview-link').off();
|
|
|
|
$('.image-preview-link').click(function(e) {
|
|
|
|
e.preventDefault();
|
|
|
|
var name = $(this).find('p').text();
|
|
|
|
var url = $(this).find('img').data('large-url');
|
|
|
|
var downloadUrl = $(this).attr('href');
|
|
|
|
var description = $(this).data('description');
|
|
|
|
openPreviewModal(name, url, downloadUrl, description);
|
|
|
|
});
|
|
|
|
}
|
2016-12-16 17:43:14 +08:00
|
|
|
|
2016-12-20 00:36:18 +08:00
|
|
|
function openPreviewModal(name, url, downloadUrl, description) {
|
|
|
|
var modal = $('#imagePreviewModal');
|
|
|
|
modal.find('.image-name').text(name);
|
|
|
|
var link = modal.find('.image-download-link');
|
|
|
|
link.attr('href', downloadUrl);
|
|
|
|
var image = modal.find('.modal-body img');
|
|
|
|
image.attr('src', url);
|
|
|
|
image.attr('alt', name);
|
|
|
|
modal.find('.modal-footer .image-description').text(description);
|
|
|
|
modal.modal();
|
|
|
|
}
|