Jquery $(this) 表示什么ul,li{margin:0;padding:0}#scrollDiv{width:300px;height:50px;line-height:25px;border:#ccc 1px solid;overflow:hidden}#scrollDiv li{height:50px;padding-left:10px;}function AutoScroll(obj){$(obj).find("ul:first").animate({margi

来源:学生作业帮助网 编辑:作业帮 时间:2024/05/05 01:05:55
Jquery $(this) 表示什么ul,li{margin:0;padding:0}#scrollDiv{width:300px;height:50px;line-height:25px;border:#ccc 1px solid;overflow:hidden}#scrollDiv li{height:50px;padding-left:10px;}function AutoScroll(obj){$(obj).find(

Jquery $(this) 表示什么ul,li{margin:0;padding:0}#scrollDiv{width:300px;height:50px;line-height:25px;border:#ccc 1px solid;overflow:hidden}#scrollDiv li{height:50px;padding-left:10px;}function AutoScroll(obj){$(obj).find("ul:first").animate({margi
Jquery $(this) 表示什么
ul,li{margin:0;padding:0}
#scrollDiv{width:300px;height:50px;line-height:25px;border:#ccc 1px solid;overflow:hidden}
#scrollDiv li{height:50px;padding-left:10px;}
function AutoScroll(obj){
$(obj).find("ul:first").animate({
marginTop:"-50px"
},500,function(){
$(this).css({marginTop:"0px"}).find("li:first").appendTo(this);
});
}
$(document).ready(function(){
setInterval('AutoScroll("#scrollDiv")',1000)
});


这是公告标题的第一行

dfgsdfgsdfgsdfgs
这是公告标题的第二行

dfgsdfgsdfgsdfgs
这是公告标题的第三行

dfgsdfgsdfgsdfgs
这是公告标题的第四行

dfgsdfgsdfgsdfgs
这是公告标题的第五行
这是公告标题的第六行
这是公告标题的第七行
这是公告标题的第八行

Jquery $(this) 表示什么ul,li{margin:0;padding:0}#scrollDiv{width:300px;height:50px;line-height:25px;border:#ccc 1px solid;overflow:hidden}#scrollDiv li{height:50px;padding-left:10px;}function AutoScroll(obj){$(obj).find("ul:first").animate({margi
$(obj).find("ul:first").animate({
marginTop:"-50px"
},500,function(){
$(this).css({marginTop:"0px"}).find("li:first").appendTo(this);
});
其中this代表 查找的目标ul 对象 ,但这是javascript对象,它是不能直接使用jQuery API的必须转换为jQuery 对象 即 $(this)如此包装 ,即可使用 如 jQuery.css 方法