<!DOCTYPE html>
<html>
<head>
<title>
</title>
<style>
</style>
<script type="text/javascript">
$(document).ready(function {
$('img').slideDown('slow');
});
</script>
</head>
<body>
<img src="images\sjmak-music-logo.jpeg"/>
</body>
</html>
上面的简单代码示例不起作用;我试图简单地使图像从屏幕顶部向下滑动,但它保持静态。我还尝试在图像上使用“display: none”,但图像仍然隐藏,而不是从顶部向下滑动。
最佳答案
您需要包含 jQuery library file使用jQuery methods .
在下面的示例中添加了 jquery cdn 版本。另外,要向下滑动图像,必须先隐藏它
<!DOCTYPE html>
<html>
<head>
<title>
</title>
<style>
</style>
<script type="text/javascript" src="http://code.jquery.com/jquery-1.10.2.min.js"></script>
<script type="text/javascript">
$(document).ready(function() {
$('img').slideDown('slow');
});
</script>
</head>
<body>
<img src="images\sjmak-music-logo.jpeg" style="display: none"/>
</body>
</html>
演示:Fiddle
关于javascript - jQuery SlideDown 脚本在简单代码示例中不起作用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19499030/