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" />
精彩评论