开发者

How to apply Toggle method for another method?

开发者 https://www.devze.com 2023-04-10 03:59 出处:网络
I have a script with jquery, and it is running but not as expected, I do not know where the location is wrong.

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

精彩评论

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