Forums

The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums JavaScript [Solved] Give something a random z-index

  • This topic is empty.
Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #30084
    noahgelman
    Participant

    I have a div I want to give a random z-index when the page loads. how would I do that?

    #81077
    noahgelman
    Participant

    Well I wanted a random z-index because I have some layers items I want random switched out on each page load. I found this to give me a random number (1-10)

    var randomnumber=Math.floor(Math.random()*11)

    But I want the code spectrum to be between -50 and 50, how would I change that?

    #81079
    noahgelman
    Participant

    Nevermind, this site explains the syntax and how to do it very nicely. Thanks for your inquiry.

    http://www.kadimi.com/en/negative-random-87

Viewing 3 posts - 1 through 3 (of 3 total)
  • The forum ‘JavaScript’ is closed to new topics and replies.