How To Make More Images Appear On The Same Spot??

by zannix
6 replies
Hi guys, sorry for the confusing title. I tried posting this in the web design section but obviously noone has a clue.

Anyway, basically what I need to have is an image that changes (first it shows one image, then another, then another, etc.) with an option to set the time difference between the change, of course - and with each image having it's own link!

This link thing is very important. I've actually found a script that changes images, but they all contain one link

Here's my old script:

<a href="my link">
<img src="image source" alt="" width="200" height="220" id="rotator">
<script type="text/javascript">
(function() {
var rotator = document.getElementById('rotator'); // change to match image ID
var imageDir = ''; // change to match images folder
var delayInSeconds = 5; // set number of seconds delay
// list image names
var images = ['test.JPG','jogging.JPG'];

// don't change below this line
var num = 0;
var changeImage = function() {
var len = images.length;
rotator.src = imageDir + images[num++];
if (num == len) {
num = 0;
}
};
setInterval(changeImage, delayInSeconds * 1000);
})();
</script>


How to modify this in a way each picture contains it's own link?

Thank you!
#images #make #spot
  • Profile picture of the author wayfarer
    A simpler solution would just to put a bunch of links with images in them, then pass them through a rotation plugin such as jQuery Cycle

    HTML Code:
    <div id="cycle">
        <a href="/link1.html"><img src="image1.jpg" alt="" /></a>
        <a href="/link2.html"><img src="image2.jpg" alt="" /></a>
        <a href="/link3.html"><img src="image3.jpg" alt="" /></a>
    </div>
    Code:
    <script type="text/javascript">
    $('#cycle').cycle();
    </script>
    Signature
    I build web things, server things. I help build the startup Veenome. | Remote Programming Jobs
    {{ DiscussionBoard.errors[3794807].message }}
    • Profile picture of the author zannix
      Thank you - will that work in wordpress? Since I'm running a wordpress blog and I want to install such code into a sidebar text widget.
      {{ DiscussionBoard.errors[3795304].message }}
      • Profile picture of the author wayfarer
        Originally Posted by zannix View Post

        Thank you - will that work in wordpress? Since I'm running a wordpress blog and I want to install such code into a sidebar text widget.
        As long as there's jQuery the cycle plugin will work. Wordpress doesn't create any limits, it follows all the same rules of any other website.
        Signature
        I build web things, server things. I help build the startup Veenome. | Remote Programming Jobs
        {{ DiscussionBoard.errors[3795339].message }}
        • Profile picture of the author zannix
          Ohh I know that, I just thought that maybe there's a wordpress plugin to download, to enable me to use a function like that. Ive never used any plugins other than the ones I find through wordpress - could you please lay out for me a step by step to follow?

          If it's not too much trouble for you, I'd appreciate it immensly!
          {{ DiscussionBoard.errors[3795477].message }}
  • Profile picture of the author wayfarer
    No idea if there's an actual Wordpress plugin, but I would be surprised if no one has built one. Try searching for "content rotator" or "image cycle"
    Signature
    I build web things, server things. I help build the startup Veenome. | Remote Programming Jobs
    {{ DiscussionBoard.errors[3795484].message }}
    • Profile picture of the author zannix
      Just did a search, found it! Wp-Cycle.


      Thank you very much - you rock!
      {{ DiscussionBoard.errors[3795502].message }}

Trending Topics