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

animate objects with css3 after clicking a link (before you leave the page)

  • Hi I made a coming soon page for my band antibiotics. After the page is loaded, the pictures slide in (animated with css3). Now what i wanna do is animate them (fade or slide out) when you click the "to our songs"-link.

    Is it possible to do this just with css3?

    Thanks for your help! :)

    Johnny

  • You can animate things with CSS. You can't delay the default behaviour of an element. A link isn't supposed to wait before acting when clicked.

    You'll have to use JavaScript to delay the behaviour of the link.

  • Thank you for your answer! Now as I know that I can not do it whit css only, how do i have to do it with JavaScript? I'm pretty familliar with HTML and CSS but I only know a litte bit of JavaScript.

    Thanks! Johnny

    PS: i made a quick sketch how it should work imageand you can find the demo site here.
    the username is usr and the password pw ;)

  • Unless you put all your content in a single page and all your anchors point into the same page and you just do your animations on :target.

  • You can use this plugin.

    http://joelb.me/scrollpath/

    Need to make customize as per your requirement.