Forums

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

Home Forums JavaScript Random background image javascript help

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

    I’ve been trying to get a div to load a different background image everytime the page is loaded, but can’t get it to work at all. If anyone could help that would be greatly appreciated. Here is some code:

    [CodePen](http://codepen.io/jkinney768/pen/wkmsjhttp://codepen.io/jkinney768/pen/wkmsj”)

    #116463
    brebory
    Member

    You have a couple of issues with your code. First of all, with codepen, you don’t need to put the javascript inside of `

    #116474
    tbwiii
    Participant

    It’s probably a good idea to move those image paths to CSS and just put different classes on via the JavaScript.

    Here’s an example: [codepen](http://codepen.io/tbwIII/pen/yfwEe “Codepen Example”)

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