Forums

How can I add Rollover effect in a scrolling gallery? (4 posts)

  1. J.Hoque Photography
    Member
    Posted 2 years ago #

    Does anyone know of any plugins or code that will allow me to add rollover (Mouseover) effect within a scrolling gallery?

    I want to start offering a Photo Retouching service and need to create a gallery which will show before and after images when the user hovers over each photo, while scrolling through the gallery.

    I'm a novice at any kind of coding so a plugin will be great, but I can apply any coding as long as I know WHERE to place it. I just need the code and instructions.

    I'm currently using Nextgen Smooth Gallery with an edited iNove theme.
    View my blog here: http://www.jhoque.com.

    Please help...

  2. rate4d
    Member
    Posted 2 years ago #

    You can see my status on avatar ^^ im not programmer, im not very good designer, but I know some pieces of both, so I have 2 offers.
    1.Make new page or post or whatever for your retouthing examples, and make rollover images with html, the code should be

    <script type="text/javascript">
    <!--
    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_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_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>
    <body onLoad="MM_preloadImages('rollover_image_path')"><a href="#" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('Image_name','','rollover_image_path',1)"><img name="Image_name" border="0" src="original_image_path"></a>

    you should change just the last line and tell the script yout image paths.

    2nd maybe better offer, with it you will be able to show it in your current gallery, just make the .gif of 2 images 1 original and 1 retouched, make interval between switching 3 seconds and it will be cool.
    Sorry there are not very professional solutions, but something better than nothing, maybe more professional people will offer something better

  3. J.Hoque Photography
    Member
    Posted 2 years ago #

    @ rate4d:

    Thanks for the reply. I tried the code but it only loads one image.

    I already thought of the animated GIF, but would use it only as a last resort. I want to let the viewer have control. It gets annoying when examining one part of an image and then it suddenly changes.

    Also, I need all the images to be in one gallery, either scrolling or clickable to show the next.

    Something similar to this:

    http://www.photofixer.co.uk/flash/index.html

    I know that site is done with Flash, but I have seen others done with either Javascript or CSS, I just lost the links to them so can't show you what I mean. Will post them if I find them again.

    Thanks in advance for the help.

  4. rate4d
    Member
    Posted 2 years ago #

    I saw the photofixer gallery, now I understand what do you want to do, but still 2 offers :D
    1.Google a bit for a rollover code, it must work, maybe I just written wrong.
    2.Change the gallery plugin that it allows rollover, im not master but you can read here http://www.dyers.org/blog/archives/2006/03/10/hacking-the-sociable-wordpress-plugin-for-image-rollovers/
    3.Always then you face the problem there are 3 ways to solve it.First you can do it yourself.Second you read about it and learn how to do it.And the last, you pay the person who can do it, and the problems solved :D

Topic Closed

This topic has been closed to new replies.

About this Topic