建立通知
重要性:5
撰寫一個函式 showNotification(options)
,建立一個通知:<div class="notification">
,內容為給定的內容。通知應該在 1.5 秒後自動消失。
選項為
// shows an element with the text "Hello" near the right-top of the window
showNotification({
top: 10, // 10px from the top of the window (by default 0px)
right: 10, // 10px from the right edge of the window (by default 0px)
html: "Hello!", // the HTML of notification
className: "welcome" // an additional class for the div (optional)
});
使用 CSS 定位在指定的頂部/右側座標顯示元素。原始文件具有必要的樣式。