Results 1 to 2 of 2

Thread: Trying to pick an image from random

  1. #1
    Join Date
    Sep 2009

    Trying to pick an image from random

    Okay, so I have a parent div that contains nothing but images. I want to select one of these images at random to display. I have display: none for css, so I am using the show() from jQuery. I'm using the DatePicker plugin to grab a random date. I know that the issue is not with the show() and selectors I am using as I isolated them and all the images displayed. Here is my code:

    $(document).ready(function() {
    	var count = $("* > #Images").length;
    	var randomNumber = Math.round(Math.random() * count *  DatePickerGetDate);
    The Images div has three images that are linked properly and will display properly if display: none is removed or the show() is used. I'm sure it's something really simple I just can't figure it out.

  2. #2
    Join Date
    Oct 2006
    First I'm wondering if you are loading all images?
    That wouldn't be efficient, wouldn't be smart.
    Next, I'm wondering why I don't see javascipt in the javascript forum.
    So then, I'm thinking maybe they could have a jQuery forum...
    I don't know, I'm just a little disappointed, just like when someone posts PHP code here too.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

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