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

Home Forums JavaScript “Fade to black” effect

  • This topic is empty.
Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
  • #37281

    I’ve hit a bit of a snag in creating a “fade to black” effect. What I’ve come up with works in JSFiddle, which you can see here:

    But not on the following test page viewed in Safari and Chrome (haven’t tested it in other browsers):


    Any idea what I’ve done wrong?

    Thanks in advance for any help.


    Thanks for the suggestion, karlpcrowley, but I get the same results: no problem in JSFiddle; no go in browser.

    Also, I suppose you meant that I should use:


    in the otherwise empty div?


    I wasn’t working with a live page, just one on my desktop. I did put the page up at:

    and got the same results.

    Thanks for your help.


    I think there may be something wrong with the semi-colon at the end of your script, or an invisible weirdo character that comes after it (perhaps if you copy/pasted it from somewhere). Your code didn’t work for me either, but when I delete that whole line and then type it again manually, it works fine.


    Thanks, Senff — there was indeed a space after the final semi-colon. I removed and that did the trick.

    And thanks, karlpcrowley — I should have verified the code.

    I appreciate the speedy replies!

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