aggiunta funzione per preview immagine sulle img clickable

This commit is contained in:
Lorenzo Giacomelli
2016-03-18 19:37:00 +01:00
parent 0dcafb2d94
commit 24a69fd9ad
4 changed files with 37 additions and 5 deletions
@@ -13,14 +13,15 @@ class MediaImage extends MediaRenderer{
if(array_key_exists("size", $opt) && array_key_exists($opt["size"], self::$SIZES)){
$size = $opt["size"];
}
$click = "";
if (array_key_exists("clickable", $opt)){
$clickable = $opt["clickable"];
if($clickable){
$click='onclick="javascript:previewImage(\''.GUIHandler::getBaseUrl().'getImage.php?id='.$this->id.'&size='.MediaRendererInterface::SIZE_BIG.'\')"';
}
}
return '<img itemprop="image" src="'.$this->getImageLink($size).'"/>';
return '<img itemprop="image"'.$click.' src="'.$this->getImageLink($size).'"/>';
}
public function render(array $opt = array ()){
+3
View File
@@ -107,7 +107,10 @@ try {
}
GUIHandler::generateHtmlHeaders(array("additionalHeaders"=>$additionalHeaders));
?>
<div class="imageOverlay" onclick="javascript:hidePreview()"></div>
<div class="clickableImageContainer" onclick="javascript:hidePreview()"></div>
<div style="width:1000px;margin-left:auto;margin-right:auto;" itemscope itemtype="http://schema.org/Article">
<?php
GUIHandler::generateHeadPublic();
+16
View File
@@ -62,4 +62,20 @@ function bannerRoll(prev,pos){
$('#'+prev).parent().html(data);
}
});
}
function previewImage(imageSrc){
$('.clickableImageContainer').html('<img id ="clickImage" src="'+ imageSrc +'" />');
$('.imageOverlay').css("display","block");
$('.clickableImageContainer').css("display","block");
// $('#clickImage').focus();
$('html, body').animate({
scrollTop: $("body").offset().top
}, 1000);
}
function hidePreview(){
$('.imageOverlay').css("display","none");
$('.clickableImageContainer').css("display","none");
$('#clickImage').remove();
}
+15 -3
View File
@@ -504,13 +504,25 @@ Password Recovery
*/
.clickableImageContainer{
.imageOverlay{
position: fixed;
opacity: 0.9;
width: 100%;
height: 100%;
background-color: black;
text-align: center;
z-index: 100;
z-index: 10;
margin-top: -10px;
margin-left: -10px;
display:none;
}
.clickableImageContainer{
position: absolute;
margin: auto;
text-align: center;
opacity: 1;
width: 100%;
z-index: 11;
display:none;
}
.clickableImageContainer > img{opacity:0;}