<html>
<head>
<script type="text/javascript" src="/jquery/jquery.js"></script>
<script type="text/javascript">
$(".left").click(function(){
if ( $("div").hasClass("protected") )
$(this).animate({ left: -10});
});
</script>
<style type="text/css">
.protected {font-style:italic;}
</style>
</head>
<body>
<div class="protected">ddddd</div><div></div>
<button id="left">«</button> <button id="right">»</button></body>
</html>
问下问什么我的div没有变化求解释刚接触jquery
$(document).ready(function(){});
http://www.w3school.com.cn/tiy/t.asp?f=jquery_animation
<html>
<head>
<script type="text/javascript" src="/jquery/jquery.js"></script>
<script type="text/javascript">
$(document).ready(function(){
$("div").click(function(){
if ( $(this).hasClass("protected") ) $(this).animate({height:300},"slow");
.animate({width:300},"slow");
.animate({height:100},"slow");
.animate({width:100},"slow");
});
});
</script>
<style type="text/css">
.protected {background:#98bf21;height:100px;width:100px;position:relative}
</style></head>
<body>
<div id="box" class="protected">
</div><div>dddd</div>
</body>
</html>
谢谢
$("div").click(function(){
if ( $(this).hasClass("protected") ) $(this).animate({height:300},"slow");
.animate({width:300},"slow");
.animate({height:100},"slow");
.animate({width:100},"slow");
});
});
你这写的什么啊。。
<html>
<head>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"></script>
<script type="text/javascript">
$(document).ready(function(){
$("div").click(function(){
if($(this).hasClass("protected"))
{
$(this).animate({ height: 300 }, "slow").animate({ width: 300 }, "slow").animate({height:100},"slow").animate({ width: 100 }, "slow");
}
});
});
</script>
<style type="text/css">
.protected
{
background: #98bf21;
height: 100px;
width: 100px;
position: relative;
}
</style>
</head>
<body>
<div id="box" class="protected">
</div>
<div>dddd</div>
</body>
</html>