css3 - Why are not my balloons flying properly? Css animation translate -


I am trying to do the following with CSS translation:

When a button is clicked Is, balloons appear and fly away When they finish the flight, they disappear and return to the starting position (so that the next time a button is clicked on the same behavior).

So far I got (balloon is flying only and does not appear / disappears).

HTML

  & lt; Div & gt; & Lt; Img class = "object" src = "http://pngimg.com/upload/balloon_PNG580.png" /> & Lt; / Div & gt; & Lt; Br> & Lt; Br> & Lt; Button id = "button" & gt; Fly !!! & Lt; / Button & gt;  

CSS

  div {height: 300px; Status: Relative; } .object {width: 60px; Status: Completed; Bottom: 0; -WebKit-Infection: All 1s Easy-In-Out; -Mozy-transition: All 1s Easy-In-Out; -O-Infection: All 1s Easy-In-Out; } .move-up {transform: translate (0, -150px); Webkit-Conversions: Translation (0, 150px); -o-conversion: translation (0, 150px); -MOZ-TRANSFORM: Translation (0, 150px); } {$ ('. Object')  

JS

  $ ('# button') .addClass ('move -Up');});  

The problem is that when I see it with turning on display: none and clicking on $ ('. Object') on click Try it Show () My animation does not start at all How can my balloon fly?

You can achieve this effect by using CSS3 Animation. Please see inline comment for more details on each item.

CSS:

  .object {width: 60px; Status: Completed; Bottom: 0; Opacity: 0; / * On the load, the bulbs make invisible and once the animation is completed * /. Up-up {-webkit- Animation: Balloon 1S Linear; / * To move the animation * / -moz- Animation: Balloon 1s linear; Animation: Balloon 1s Linear; } @Keframe balloon contains only prefix version to answer, Demo also has Prefix versions * / 5% {Transform: Translation (0, 0); / * Keep in the original position * / Opacity: 1; / * Showing Opacity as Bullet for Less after a short time * /} 50% {Conversion: Translation (0, 150px); / * Plating * / Blurring: 1; / * Maintains Opacity * 55%, 100% {Conversion: Translation (0, 150px); / * Keep the translation status to the end * / Opacity: 0; / * Hide the balance and hide it for the remaining period *  

jQuery:

  $ ('. Object '('. Object ') AddClass (' move-up '); // Move the animation class to move it up $ ('. Object.move-up ' (Animated WebKit Animation and MS Animation and Animation and), Function () {$ ('. Object'). Remove the animation class from the animation class and return it originally. state} };});  


Comments

Popular posts from this blog

sqlite3 - UPDATE a table from the SELECT of another one -

c# - Showing a SelectedItem's Property -

javascript - Render HTML after each iteration in loop -