diff --git a/public/js/app.js b/public/js/app.js index 6fa6487..2d091f9 100644 --- a/public/js/app.js +++ b/public/js/app.js @@ -78,19 +78,19 @@ function closeBox() function showImage(id) { point = pointsSources[id]; + photos = []; + + if( typeof($('.fotorama').data('fotorama')) != 'undefined' ) + { + $('.fotorama').data('fotorama').destroy(); + } + $('#imageModalLabel').text(point.name); + $('#imageModalImg').hide(); + $('.fotorama').show(); if (typeof(point.images) == 'object') { - if( typeof($('.fotorama').data('fotorama')) != 'undefined' ) - { - $('.fotorama').data('fotorama').destroy(); - } - - $('#imageModalImg').hide(); - $('.fotorama').show(); - - photos = []; point.images.forEach(function(entry) { if (window.devicePixelRatio > 1) { 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}); } }); - - initFotorama('.fotorama', photos); } else { - $('#imageModalImg').attr('src', point.img); - $('#imageModalImg').show(); - $('.fotorama').hide(); + photos.push({img: point.img, thumb: point.img}); } + + initFotorama('.fotorama', photos); $('#imageModal').modal('show'); }