treehouse : what would you like to learn today?
Web Design Web Development iOS Development

setTimeout with fadeIn & fadeOut? Help Needed Please

  • Howdy all,

    I'm using the bit of JS below to redirect an HTML page to another page after 2.5 seconds. The transitions are a bit harsh though and I am looking to integrate a fadeIn / fadeOut to the script. Please excuse my ignorance…this seems fairly easy, but I cant seem to solve it. Any help is much appreciated. Cheers.

    setTimeout(function() {
    window.location.href = "work.html";
    }, 2500);
  • What about changing the url after whatever item has faded out? Make it take 2.5 seconds to fade out and change page directly afterwards
    $('#whatever-item').fadeout(function(){
    window.location.href = "work.html";
    }, 2500);
  • Hi jamy…just gave your code a try, didn't quite seem to solve the issue. This caused the page to not change urls at all
  • Oh right, your code above wouldn't work either actually.

    It's meant to be
    window.location = "work.html"
    not window.location.href