...

View Full Version : JavaScript Photo Gallery help!!!



thehumanbeast
06-18-2010, 11:31 PM
Hi! I've been working on a javascript photo gallery on my talent agency's website. I'm running into a bit of trouble with two things...

First off, i would like it that when the mouse is removed from the thumbnail, that the image the mouse was last on would remain on screen but the thumbnail wouldnt change back.

Also, i cant figure out how to make it that when an image is being displayed, the photographer and makeup artist information could also be seen under the picture.

Any help in this would be GREATLY appreciated!


A sample of one of the pages this is being used on is the following: http://www.cyanidenation.com/dakygallery.html

The code I'm using is the following:


<!--
function MM_preloadImages() { //v3.0
var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_swapImgRestore() { //v3.0
var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_findObj(n, d) { //v4.01
var p,i,x; if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}
//-->
</script>



Thanks for the help!

Old Pedant
06-19-2010, 12:14 AM
Ah, good old DumbWacker code. DrumWaster sure produces some of the worst (and oldest) JS code in the business.

You really ought to toss out that junk code and find more modern stuff, but ...

The simple answer, for you, is *probably* to just change this code

function MM_swapImgRestore() { //v3.0
var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

To this:

function MM_swapImgRestore() { /* do nothing at all */ }


If that doesn't work, ask again.

thehumanbeast
06-19-2010, 05:16 PM
Problem is, if i do just that, the image swap stops working completely. If i remove the image restore from the body, it keeps swapping, but the all the thumbnails become the first picture, which is what i want to stop.

If you have any newer code that could be more useful to me, please do send it so i can give it a shot!


Also, I'm still having trouble with the adding the photographer info in text under the picture. if anyone could help with that, it would be greatly appreciated.

randomuser773
06-20-2010, 12:12 AM
If you have any newer code that could be more useful to me, please do send it so i can give it a shot!

Also, I'm still having trouble with the adding the photographer info in text under the picture. if anyone could help with that, it would be greatly appreciated.

http://scripterlative.com/files/thumbsmart.htm

If you still want to swap the thumbnails as well:
http://scripterlative.com/files/smartroll.htm

I would recommend putting the caption element at the top with position:fixed, otherwise with that layout it could be missed entirely.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum