开发者

How to apply Toggle method for another method?

I have a script with jquery, and it is running but not as expected, I do not know where the location is wrong.

<img onclick="$(this).click('toggle', function(){
    $(this).animate({width : '1024px', height : '500px'});
},function(){ 
    $(this).animate({width : '100px', height : '100px'}); 
});" class="magnify" src="a.jpg开发者_StackOverflow中文版" border="1" alt="cantik_1" width="200" height="auto" />


try this

<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" />
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜