Need some Javascript help......

by zozja
3 replies
Hey!

I have a question and am hoping some of you expert Warriors can help me out. I'm doing some website maintenance for a company and need to modify some javascript- which I don't know much about.

The website has a serious of folders for different webpages called "mainPicture". The javascript that commands these folders is currently set up to display pics in a slideshow in alphabetical order. I need to figure out how to display pics randomly, so that they always show in a different order.

I've attached the javascript document that I'm pretty sure needs to be modified to accomplish this.

If anyone can give me some direction on this that would be awesome! Thanks so much!!!!

Rebecca
#javascript
  • Profile picture of the author burton247
    Not really sure how to do it that code. I would put the file names into an array and shuffle them but that is not a very good solution.

    Do you have to use that slider? I'm not sure whether it is really the same but the one on my website - Michael Burton | Home takes images inside a div that are in a list then displays them randomly. Refresh to the page a couple of times and you'll see what I mean. That slider is the nivo slider Nivo Slider - The Most Awesome jQuery Image Slider and it uses jquery.

    If you definitely have to use what you have been given I can take a deeper look at it though.
    {{ DiscussionBoard.errors[3691181].message }}
    • Profile picture of the author zozja
      Hey! Thanks for the response... Yes, I do have to use the script that I attached or "slider" as you called it

      Any ideas?

      Thanks!

      Originally Posted by burton247 View Post

      Not really sure how to do it that code. I would put the file names into an array and shuffle them but that is not a very good solution.

      Do you have to use that slider? I'm not sure whether it is really the same but the one on my website - Michael Burton | Home takes images inside a div that are in a list then displays them randomly. Refresh to the page a couple of times and you'll see what I mean. That slider is the nivo slider Nivo Slider - The Most Awesome jQuery Image Slider and it uses jquery.

      If you definitely have to use what you have been given I can take a deeper look at it though.
      {{ DiscussionBoard.errors[3694945].message }}
      • Profile picture of the author burton247
        Haven't really got time to take a proper look now. But you're reading the images in from somewhere. When you load them store them all in an array. Now you have access all all the images as you want them. If they want a random order each time the page is loaded then write a function that will randomise the array and then print them to screen as normal. If you need a different image each time it is sliding (so not in any sequence) then pull a random image to start with, then generate a new rand number and pull that element in as long as it is not equal to the one being currently displayed.

        There is probably a better way of doing this but that is how I would do it having a quick think now. But I don't know javascript all that well.
        {{ DiscussionBoard.errors[3705246].message }}

Trending Topics