我有一个带jquery的脚本,它正在运行但不是预期的,我不知道位置错在哪里。
<img onclick="$(this).click('toggle', function(){
$(this).animate({width : '1024px', height : '500px'});
},function(){
$(this).animate({width : '100px', height : '100px'});
});" class="magnify" src="a.jpg" border="1" alt="cantik_1" width="200" height="auto" />
答案 0 :(得分:2)
试试这个
<script language="javascript">
$(document).ready(function(){
$("#img1").toggle(function(){
$(this).animate({width : '1024px', height : '500px'});
},function(){
$(this).animate({width : '100px', height : '100px'});
});
});
</script>
<img id="img1" class="magnify" src="a.jpg" border="1" alt="cantik_1" width="200" height="auto" />