Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can i execute a css3 transition when the document loads using javascript?

i was just wondering if i could make a form slide when the page loads

 <!DOCTYPE html>
 <html>
 <head>
 <link rel="stylesheet" href="css/gi.css">

 </head>
 <body onload='document.getElementById("form1").style["-webkit-transform"] = "translateX(100px);"'>
 <form action='gi.php' method='post' id='form1'>
 <!-- form elements -->
</form>
</body>
</html>

that's the code im working on

note: this html will be placed inside an iframe

any responses would be appreciated

like image 244
Thamus Avatar asked Mar 19 '26 09:03

Thamus


1 Answers

You can try something like this

form {
  transform: translateX(1000px);
  -webkit-animation: move 2s forwards;
}
@-webkit-keyframes move {
  100% {
    transform: translateX(0)
  }
}
<form action='gi.php' method='post' id='form1'>
  <input type="button" value="button">
  <input type="button" value="button">
  <input type="button" value="button">
  <input type="button" value="button">
  <input type="button" value="button">
  <input type="button" value="button">
</form>
like image 140
Akshay Avatar answered Mar 21 '26 22:03

Akshay