这样一段代码
'''javascript
$(function(){
var ti=null;
ti=setInterval('scro("#con1")',500);
$('#con1').hover(function(){
clearInterval(ti);
},function(){
ti=setInterval('scro("#con1")',500);
})
})
function scro(obj){
$(obj).animate({marginTop:'-24px'},500,function(){
$(this).css({'margin-top':'0px'}).find('li:first').appendTo(this);
});
};
'''
为什么把函数scro放到$(function(){})里面,函数就会报错而不执行,求指教,谢谢。
Copyright 2014-2026 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号
这段代码我觉得从实践上并不是很优化,我从我的思路帮你写一下,参考一下