ciauz a tutti...ho un problema con uno script che sto utilizzando sul mio sito....
lo script ha la funzione di ridimensionare le immagini in caso siano + grandi di una dimensione stabilita...il fatto è che molte volte quando accedo alla pagina la foto viene visualizzata con le dimensioni reali...
credo sia dovuto al fatto che explorer salva nella cache la pagina...
infatti se aggiorno la pagina tutto viene visualizzato correttamente...
lo script che utilizzo è il seguente..
codice:
// =============================================================================
// Begin user defined variables - Variabili definite dall'utente
// =============================================================================
var resizeType = 1; // 0 = Ridimensiona variabilmente dividendo la risoluzione dello schermo
// per la variabile dynamicDivisor definita sotto.
// (i.e. 1024/4 = 256 or 1280/4 = 320)
// 1 = ridimensiona l'immagine se è più larga del fixedWidth
// impostato sotto
var enlargeType = 1 // 0 = Apre nella stessa finestrta
// 1 = Apre in una nuova finestra
var fixedWidth = 480; // Ridimensiona l'immagine se è più larga di tot
// pixels. Funziona solo con resizeType = 1.
var dynamicDivisor = 2; // Ridimensiona l'immagine alla risoluzione dello schermo divisa per
//questo valore. Viene usato solo con resizeType = 0.
var alignClose = "right"; // I valori sono 'left' or 'right'. Default è right.
var topSpacing = 50; // Allontana la finestra pop-up Di questo numero di pixel
// dalla cima della finestra
var leftSpacing = 50; // Allontana la finestra pop-up Di questo numero di pixel
// dalla sinistra della finestra
// =============================================================================
// End of user defined variables
// =============================================================================
function resizeImage(thisimage) {
if (resizeType == 0) fixedWidth = parseInt(screen.width/dynamicDivisor);
if (thisimage.width > fixedWidth) {
thisimage.width = fixedWidth;
thisimage.style.cursor='pointer';
}
}
function doimage(imgObj,event){
if (document.images) enlargeimg(imgObj,event);
}
//Thumbnail image viewer-
//© Dynamic Drive (www.dynamicdrive.com)
//For full source code, usage terms, and 100's more DHTML scripts, visit http://www.dynamicdrive.com
var ie=document.all
var ns=document.layers
var ns6=document.getElementById&&!document.all
function enlargeuserimage(which,e){
if (resizeType == 0) fixedWidth = parseInt(screen.width/dynamicDivisor);
if (which.width < fixedWidth) {return false;}
if (enlargeType == 0) {
if (ie||ns6){
crossobj=document.getElementById? document.getElementById("showimage") : document.all.showimage
if (crossobj.style.visibility=="hidden"){
crossobj.style.left = (ns6? pageXOffset : document.body.scrollLeft) + leftSpacing
crossobj.style.top = (ns6? pageYOffset : document.body.scrollTop) + topSpacing
alignRE = /^left$/i
crossobj.innerHTML= (alignRE.test(alignClose))? '<div class=tvhead align=left id=drag><span class=tvclosex onClick=closepreview() style=cursor:pointer> X </span><span class=tvclose onClick=closepreview()>Close</span> </div>[img]'+which.src+'[/img]' : '<div class=tvhead align=right id=drag> <span class=tvclose onClick=closepreview()>Close</span><span class=tvclosex onClick=closepreview() style=cursor:pointer> X </span></div>[img]'+which.src+'[/img]';
crossobj.style.visibility="visible"
}
else
crossobj.style.visibility="hidden"
return false
}
else if (document.layers){
if (document.showimage.visibility=="hide"){
document.showimage.document.write('[img]'+which.src+'[/img]')
document.showimage.document.close()
document.showimage.left=e.x
document.showimage.top=e.y
document.showimage.visibility="show"
}
else
document.showimage.visibility="hide"
return false
}
else
return true
}
else if (enlargeType == 1) {
eval('window.open("showpic.asp?pic=' + which.src + '","","width='+which.width+'px,height='+which.height+'px,resizable=1,scrollbars=1")')
}
}
function closepreview(){
crossobj.style.visibility="hidden"
}
//By Dynamicdrive.com
//drag drop function for NS 4////
/////////////////////////////////
var nsx,nsy,nstemp
function drag_dropns(name){
temp=eval(name)
temp.captureEvents(Event.MOUSEDOWN | Event.MOUSEUP)
temp.onmousedown=gons
temp.onmousemove=dragns
temp.onmouseup=stopns
}
function gons(e){
temp.captureEvents(Event.MOUSEMOVE)
nsx=e.x
nsy=e.y
}
function dragns(e){
temp.moveBy(e.x-nsx,e.y-nsy)
return false
}
function stopns(){
temp.releaseEvents(Event.MOUSEMOVE)
}
//drag drop function for IE 4+ and NS6////
/////////////////////////////////
function drag_drop(e){
if (ie&&dragapproved){
crossobj.style.left=tempx+event.clientX-offsetx
crossobj.style.top=tempy+event.clientY-offsety
}
else if (ns6&&dragapproved){
crossobj.style.left=tempx+e.clientX-offsetx
crossobj.style.top=tempy+e.clientY-offsety
}
return false
}
function initializedrag(e){
if (ie&&event.srcElement.id=="drag"||ns6&&e.target.id=="drag"){
offsetx=ie? event.clientX : e.clientX
offsety=ie? event.clientY : e.clientY
tempx=parseInt(crossobj.style.left)
tempy=parseInt(crossobj.style.top)
dragapproved=true
document.onmousemove=drag_drop
}
}
document.onmousedown=initializedrag
document.onmouseup=new Function("dragapproved=false")
qualcuno sa come ovviare il problema?
ciauz...e grazie a tutti