使用 jQuery 摆动图像
Swing an image by using j Query
我想使用 jQuery 摆动图像。我已经学习了很多教程,但我无法找到如何执行此操作。
你也可以使用 CSS: http://jsfiddle.net/gVCWE/1193/
bod{
background:blue;
}
.box{
width:50px; height:50px;
background: yellow;
border: 1px solid black;
margin:100px;
position: relative;
float: left;
-moz-animation: 3s ease 0s normal none infinite swing;
-moz-transform-origin: center top;
-webkit-animation:swing 3s infinite ease-in-out;
-webkit-transform-origin:top;
}
@-moz-keyframes swing{
0%{-moz-transform:rotate(-500deg)}
50%{-moz-transform:rotate(500deg)}
100%{-moz-transform:rotate(-500deg)}
}
@-webkit-keyframes swing{
0%{-webkit-transform:rotate(-500deg)}
50%{-webkit-transform:rotate(500deg)}
100%{-webkit-transform:rotate(-500deg)}
}
希望对您有所帮助。
我想使用 jQuery 摆动图像。我已经学习了很多教程,但我无法找到如何执行此操作。
你也可以使用 CSS: http://jsfiddle.net/gVCWE/1193/
bod{
background:blue;
}
.box{
width:50px; height:50px;
background: yellow;
border: 1px solid black;
margin:100px;
position: relative;
float: left;
-moz-animation: 3s ease 0s normal none infinite swing;
-moz-transform-origin: center top;
-webkit-animation:swing 3s infinite ease-in-out;
-webkit-transform-origin:top;
}
@-moz-keyframes swing{
0%{-moz-transform:rotate(-500deg)}
50%{-moz-transform:rotate(500deg)}
100%{-moz-transform:rotate(-500deg)}
}
@-webkit-keyframes swing{
0%{-webkit-transform:rotate(-500deg)}
50%{-webkit-transform:rotate(500deg)}
100%{-webkit-transform:rotate(-500deg)}
}
希望对您有所帮助。