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");