Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie

JavaScript Slideslow Help

Options
  • 09-11-2013 12:21am
    #1
    Registered Users Posts: 2,369 ✭✭✭


    Hey there I would appreciate any help you can give me. I've developed a pretty basic slideshow for my website assignment for college.

    I was looking through a couple of mercedes-benz websites for research and found slideshow @ http://www.bradysmercedes-benz.ie I really liked the way it gives the user control of the slideshow with the toggle button.

    So far I'm stuck on how to implement a toggle button so I can give users control over my slideshow. Is there anyway I can add it in the code below without starting from scratch?

    I would appreciate any help!


    This is the code below:

    <script type="text/javascript">
    //declare variables

    var image1=new Image()
    image1.src="images/premises.jpg"
    var image2= new Image()
    image2.src="images/a-class.jpg"
    var image3=new Image()
    image3.src="images/s-saloon.jpg"
    var image4=new Image()
    image4.src="images/e-front.jpg"
    var image5=new Image()
    image5.src="images/C-Class.jpg"

    </script>

    <div id="body">

    <!-- Slideshow JavaScript -->


    <a href="javascript:slidelink()"><img src="images/C-Class.jpg" name="slide" width="770" height="370" id="slideshow" /></a>
    <script>
    //variable that will increment through the images
    var step=1

    //variable that will keep track of the image currently being displayed
    var whichimage=1

    function slideit(){

    //if browser does not support the image object, exit.
    if (!document.images)
    return
    document.images.slide.src=eval("image"+step+".src")
    whichimage=step

    if (step<5)
    step++

    else
    step=1

    //call function "slideit()" every 2.5 seconds
    setTimeout("slideit()",3500)
    }
    slideit()
    function slidelink() {
    if (whichimage==1)
    window.location="about.htm"
    else if (whichimage==2)
    window.location="link2.htm"
    else if (whichimage==3)
    window.location="link3.htm"
    else
    window.location="link4.htm"
    }
    </script>


Comments

Advertisement