1 直接添加style
添加一个css属性
$(".channel").css({ "position": "static" });
添加多个css属性
$(".channel").css({ "position": "fixed", "width": "100%", "top": "0" });
2 添加删除class
定义一个class
.channel-fixed {
position: fixed;
width: 100%;
top: 0;
}
添加class
$(".channel").addClass("channel-fixed");
删除class
$(".channel").removeClass("channel-fixed");