Javascript 如何将切换方法应用于其他方法?
我有一个带有jquery的脚本,它正在运行,但并不像预期的那样,我不知道位置哪里错了Javascript 如何将切换方法应用于其他方法?,javascript,jquery,Javascript,Jquery,我有一个带有jquery的脚本,它正在运行,但并不像预期的那样,我不知道位置哪里错了 <img onclick="$(this).click('toggle', function(){ $(this).animate({width : '1024px', height : '500px'}); },function(){ $(this).animate({width : '100px', height : '100px'}); });" class="magnify"
<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" />
试试这个
<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" />
$(文档).ready(函数(){
$(“#img1”).toggle(函数(){
$(this.animate({宽度:'1024px',高度:'500px'});
},函数(){
$(this.animate({width:'100px',height:'100px'});
});
});
谢谢你的朋友,但这并没有改变条件,结果还是和以前一样。我已经应用到脚本中,然后加倍动作发生。选项1和选项2。我已将其应用到脚本中,然后会发生双倍的操作。选项1和选项2。尝试使用$(document).ready(函数()在上面更新)。问题以前是..现在已经解决..在我的endlet中工作正常