FIX - фоторама при одной фотке

This commit is contained in:
Krivchikov Dmitry 2015-05-27 23:50:34 +03:00
parent 8df0cf677a
commit 429fb895cf
1 changed files with 12 additions and 14 deletions

View File

@ -78,19 +78,19 @@ function closeBox()
function showImage(id) function showImage(id)
{ {
point = pointsSources[id]; point = pointsSources[id];
$('#imageModalLabel').text(point.name); photos = [];
if (typeof(point.images) == 'object')
{
if( typeof($('.fotorama').data('fotorama')) != 'undefined' ) if( typeof($('.fotorama').data('fotorama')) != 'undefined' )
{ {
$('.fotorama').data('fotorama').destroy(); $('.fotorama').data('fotorama').destroy();
} }
$('#imageModalLabel').text(point.name);
$('#imageModalImg').hide(); $('#imageModalImg').hide();
$('.fotorama').show(); $('.fotorama').show();
photos = []; if (typeof(point.images) == 'object')
{
point.images.forEach(function(entry) { point.images.forEach(function(entry) {
if (window.devicePixelRatio > 1) { if (window.devicePixelRatio > 1) {
photos.push({img: '/photos/big/'+entry, thumb: '/photos/small/'+entry}); photos.push({img: '/photos/big/'+entry, thumb: '/photos/small/'+entry});
@ -98,13 +98,11 @@ function showImage(id)
photos.push({img: '/photos/middle/'+entry, thumb: '/photos/small/'+entry}); photos.push({img: '/photos/middle/'+entry, thumb: '/photos/small/'+entry});
} }
}); });
} else {
photos.push({img: point.img, thumb: point.img});
}
initFotorama('.fotorama', photos); initFotorama('.fotorama', photos);
} else {
$('#imageModalImg').attr('src', point.img);
$('#imageModalImg').show();
$('.fotorama').hide();
}
$('#imageModal').modal('show'); $('#imageModal').modal('show');
} }