Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 4 of 4
  1. #1
    New to the CF scene
    Join Date
    Jun 2010
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    JavaScript Photo Gallery help!!!

    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:

    Code:
    <!--
    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!

  • #2
    Supreme Master coder! Old Pedant's Avatar
    Join Date
    Feb 2009
    Posts
    25,551
    Thanks
    78
    Thanked 4,382 Times in 4,347 Posts
    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
    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:
    Code:
    function MM_swapImgRestore() { /* do nothing at all */ }
    If that doesn't work, ask again.
    An optimist sees the glass as half full.
    A pessimist sees the glass as half empty.
    A realist drinks it no matter how much there is.

  • #3
    New to the CF scene
    Join Date
    Jun 2010
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts
    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.

  • #4
    Banned
    Join Date
    Nov 2008
    Location
    not found
    Posts
    284
    Thanks
    0
    Thanked 53 Times in 51 Posts
    Quote Originally Posted by thehumanbeast View Post
    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.


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •