這個工具列會固定在瀏覽器視窗底部,適合放公告、客服資訊或購物車入口。它還可以關閉,並透過 cookie 記住使用者是否關閉過。
版面核心使用 position: fixed,讓工具列不受頁面捲動影響;若要相容舊 IE,可加上 _position: absolute 與 top 表達式。
var closeBN = $.cookie("bnav");
if (closeBN == "0") { closeNav(); }
function closeNav() {
$(".openClose").toggle();
$.cookie("bnav", "0", { expires: 1 });
}工具列內的公告可用單行捲動:
$(".rolltext dd").animate({ marginTop: "-25px" }, 500, function() {
$(this).css({ marginTop: "0px" }).find("a:first").appendTo(this);
});這樣就能讓公告內容持續循環顯示,同時保留關閉與重新開啟的功能。