jquery 操作滚动条滚动 animate checkbox操作
if ($("#chkchannel").length > 0 && $("#chkchannel")[0].checked) {
Alert('checned');
}
<html>
<head>
<script type="text/javascript" src="/jquery/jquery.js"></script>
<script type="text/javascript">
$(document).ready(function()
{
$(".btn1").click(function(){
if(!$("#box").is(":animated")){
$("#comtent").animate({height : "+=50"});
} else {
alert("ddd");
}
});
$(".btn2").click(function(){
//$("#comtent").animate({height : "-=50"});
$("#comtent").css({height : "-=50"});
});
$("#test1").click(function(){
$("#comtent").animate({scrollTop: "+=17"});
$("[name='item']:checkbox").attr("checked",true);
});
$("#test2").click(function(){
$("#comtent").animate({scrollTop: "-=17"});
$("[name='item']:checkbox").attr("checked",false);
});
$("#change").click(function(){
$("[name='item']:checkbox").each(function(){
this.checked = !this.checked;
});
});
});
</script>
</head>
<body>
<textarea id="comtent" cols="10" rows="8">
向程序员的知识分享与学习社区。不允许发布任何推广、广告、政治方面的内容,不允许把博客当作SEO工具。
博客园首页是分享原创精品博文的地方,是最受关注的地方,也是被严格管理的地方。博客园首页是指网站首页,不是您的个人博客首页。
如果发到博客园首页,请一定要认真对待,多花一些工夫,拿出您的精品,让读者有真正的收获,您也会有很多收获!
如果博文不符合博客园首页质量要求,会被工作人员移出首页,望理解。
如有疑问,请联系contact@cnbl
</textarea>
<button class="btn1">Animate</button>
<button class="btn2">Reset</button>
<button id="test1">next</button>
<button id="test2">prev</button>
<button id="change">反选</button>
<input type="checkbox" name="item"/>
<input type="checkbox" name="item"/>
</body>
</html>
【推荐】还在用 ECharts 开发大屏?试试这款永久免费的开源 BI 工具!
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步