Carissimi ho trovato navigando in svariati forum del codice formidabile per ottenere l'ingrandimento di un' immagine cliccando sulla relativa icona senza ricorrere al pop up.
Ottengo anche una didascalia utilizzando il testo del ToolTip dell'icona.
Infine cliccando sull'immagine ingrandita questa si richiude.
Tutto risolto quindi ma ... sfortunatamente il tutto funziona in locale (uso VWD 2008 su Win7) ma quando pubblico su Aruba ottengo solo l'ingrandimento senza didascalia e questo non si chiude se vi clicco sopra.
Uso vb.
Allego il codice.
Sulla pagina aspx ho creato un pannello invisibile che ospiterà l'immagine ingrandita:
codice:
<div style="width: 1035px">
<asp:Panel id="pnlLargeImg"
runat="server"
CssClass ="csspnlLargeImg"
onclick="hideMe(this)"
Height="100%" ScrollBars="Auto" >
<asp:TextBox ID="txtLargeImg" runat="server" CssClass="csstxtLargeImg"></asp:TextBox><br />
<asp:Image ID="imgLargeImg"
runat="server"
ImageAlign="Middle"
CssClass ="cssimgLargeImg"
/>
</asp:Panel>
</div>
Questo è la funzione JS:
codice:
function showImage(IMG) {
enlargeImage(IMG);
showLargeImagePanel();
showTT(IMG);
unselectAll();
}
function enlargeImage(IMG){
var Image_over = new Image();
Image_over.src = IMG.src;
var Image1 = document.getElementById("imgLargeImg");
Image1.src = Image_over.src;
}
function showLargeImagePanel() {
document.getElementById('pnlLargeImg').style.visibility = 'visible';
}
function unselectAll() {
if (document.selection) document.selection.empty();
if (window.getSelection) window.getSelection().removeAllRanges();
}
function hideMe(obj) {
document.form1.txtLargeImg.value=""
obj.style.visibility = 'hidden';
}
function showTT(IMG) {
var strTT = IMG.title;
var nBr = strTT.lastIndexOf("lic")-2;
var strLanguage = document.form1.cmbLanguage.value
var strNewText=""
strTT = strTT.substr(0, nBr);
switch (strLanguage)
{ case "ENG":
strNewText = strTT + " *** Click the Image To Close It.";
document.form1.txtLargeImg.value = strNewText;
break;
case "ITA":
strNewText = strTT + " *** Clicca l'immagine per chiuderla.";
document.form1.txtLargeImg.value = strNewText;
break;
}
strTT = ""
strNewText = ""
}
</script>
Infine c'è una funzione anche sulla pagina aspx.vb relativa, una Sub su caricamento:
codice:
If Not IsPostBack Then
Me.img11.Attributes.Add("onclick", "showImage(this)")
Me.img12.Attributes.Add("onclick", "showImage(this)")
Me.img13.Attributes.Add("onclick", "showImage(this)")
Me.img14.Attributes.Add("onclick", "showImage(this)")
Me.img21.Attributes.Add("onclick", "showImage(this)")
Me.img22.Attributes.Add("onclick", "showImage(this)")
Me.img23.Attributes.Add("onclick", "showImage(this)")
Me.img24.Attributes.Add("onclick", "showImage(this)")
Me.img31.Attributes.Add("onclick", "showImage(this)")
Me.img32.Attributes.Add("onclick", "showImage(this)")
Me.img33.Attributes.Add("onclick", "showImage(this)")
Me.img34.Attributes.Add("onclick", "showImage(this)")
Me.img41.Attributes.Add("onclick", "showImage(this)")
Me.img42.Attributes.Add("onclick", "showImage(this)")
Me.img43.Attributes.Add("onclick", "showImage(this)")
Me.img44.Attributes.Add("onclick", "showImage(this)")
End If
In cui img11 ... sono le immagini presenti nella pagina e che vengono passate dinamicamente.
Tutto funziona in locale ma no su server Aruba .... AIUTO!