我是javascript新手。我試圖在我的代碼中添加動畫。就像,當我將鼠標懸停在一個節上時,ABC應該出現並從右向左移動,當我從節中移除鼠標時,它應該消失。 我已經實現了出現消失的部分,但如何添加動畫?如果有人有任何想法,請與我分享。如何使用javascript添加從左到右的動畫?
我的代碼如下所示:
<head>
<script src="/assets/bootstrap.min.js"></script>
<script type="text/javascript">
window.onload=hide_fostering;
function show_fostering()
{
document.getElementById('fostering').style.visibility="visible";
}
function hide_fostering()
{
document.getElementById('fostering').style.visibility="hidden";
}
</script>
</head>
<html>
<body>
<section onMouseOver="show_fostering()" onMouseOut="hide_fostering()">
<div class="container-fluid">
<div class="row">
<div class="col-sm-6">
<h1><strong>CONNECTING</strong></h1>
</div>
</div>
<div class="col-sm-6">
<div class="row pad-top4" id="fostering">
<h3>ABC</h3>
</div>
</div>
</div>
</section>
</body>
</html>
鑑於你有 「jQuery的」 標籤對你的問題,你看了['.animate()'方法(HTTP:// API。 jquery.com/animate/)? – nnnnnn
謝謝你的答案,但你可以告訴我在哪裏添加.animated()函數。我很新。 –
檢查此[鏈接](http://www.w3schools.com/jquery/jquery_animate.asp)。它有一個關於如何使用jQuery進行動畫製作的簡單教程。 –