fix #95 (thanks jonatkins)

This commit is contained in:
Stefan Breunig
2013-02-14 08:47:49 +01:00
parent 4ceacf719d
commit 485b1c543b
3 changed files with 14 additions and 9 deletions

View File

@ -6,21 +6,20 @@
// be run once.
window.setupLargeImagePreview = function() {
$('#portaldetails').on('click', '.imgpreview img', function() {
$('#portaldetails').on('click', '.imgpreview', function() {
var ex = $('#largepreview');
if(ex.length > 0) {
ex.remove();
return;
}
var img = $(this).parent().html();
var w = $(this)[0].naturalWidth/2;
var h = $(this)[0].naturalHeight/2;
var img = $(this).html();
var w = $(this).find('img')[0].naturalWidth/2;
var h = $(this).find('img')[0].naturalHeight/2;
var c = $('#portaldetails').attr('class');
$('body').append(
'<div id="largepreview" class="'+c+'" style="margin-left: '+(-SIDEBAR_WIDTH/2-w-2)+'px; margin-top: '+(-h-2)+'px">' + img + '</div>'
);
$('#largepreview').click(function() { $(this).remove() });
$('#largepreview img').attr('title', '');
});
}