SitePoint Sponsor

User Tag List

Results 1 to 2 of 2
  1. #1
    SitePoint Addict Jonny's Avatar
    Join Date
    Mar 2003
    Location
    Norwich, UK
    Posts
    272
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Slideshow not looping

    Hi

    Please take a look at:

    http://www.urbaneblinds.co.uk/index2.html

    See the slideshow on the right-hand side, it runs through once but although it should loop it stops and gives me the following error:

    imageObj has no properties
    http://www.urbaneblinds.co.uk/js/slides4.js
    Line 40

    However, if I change var ImageNum = 1; to var ImageNum = 0; it loops correctly. In that instance though it seems to jump past the first slide and start on slide 2, which I don't want.

    How can I fix this?

    Thanks.

  2. #2
    I meant that to happen silver trophybronze trophy Raffles's Avatar
    Join Date
    Sep 2005
    Location
    Tanzania
    Posts
    4,662
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    Probably something here:
    Code:
    var new_image = get_ImageItemLocation(imageArray[ImageNum]);
    Stick an alert() just before that line to check the value of ImageNum. I suspect something is going wrong there, most likely this which is creating a float:
    Code:
    ImageNum = (ImageNum+1) % number_of_image
    You should learn to debug your javascript by yourself. alert() is very useful for this. And if you're not using the Firebug extensions for Firefox, you really ought to, it's brilliant.

    You should also be more consistent with your variable naming. Some of them start with capital letters, some of them not. Some of them use camel casing, others use underscores, others a mixture. And by variables I also mean function names (as functions are variables themselves).

    Also, under the "Blog" section, it's "bear with us", not "bare with us".


Bookmarks

Posting Permissions

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