put all the bios in  containers with same class, use _javascript_ random() function to create a random index to show one of the bios

$('.bioClass').hide()
var bioIndex=Math.round(Math.random()*5)
$('.bioClass').eq(bioIndex).show()

random() generates random # between 0 and 1 so multiplying by 5 and rounding will return random # between 0 and 5 which will match the indexing of the 6 containers

http://www.w3schools.com/js/js_obj_math.asp


Matthew Wehrle wrote:
Hey,

At current I'm building a site in co-operation with 5 of my close
friends. On our homepage (See here: http://www.dotcommon.co.uk/index.html).
You'll notice a bio box with 6 names down the left hand side and,
thanks to jQuery, when these are clicked the bio box loads different
information about each of us (Which is stored in my jQuery tabs file
here: http://www.dotcommon.co.uk/js/tabs.js). Unforunatley when the
page loads it always displays Ross' information as his is noted in the
HTML file (Lines 54-58).

I was wondering if there's a way to have jQuery randomly choose any of
the 6 people and display their information instead of just having a
default to display every time.

Cheers again,
Matt

  

Reply via email to