iothk 發表於 2020-9-19 12:13:26

為DZ加入深色模式

本文章最後由 iothk 於 2020-9-24 10:13 PM 編輯

請尊重智慧產權,轉載包括原著資訊,感謝合作及使用
原著 : Internet of Talking講聯網
code修正參照:https://github.com/sandoche/Darkmode.js
./template/default/common/ 下的文件
footer.htm
找</body>

上面加入
<script src="https://cdn.jsdelivr.net/npm/[email protected]/lib/darkmode-js.min.js"></script><script>
function addDarkmodeWidget() {
    new Darkmode().showWidget();
}
window.addEventListener('load', addDarkmodeWidget);
</script>
預設情況下 Darkmode.js 會在網站右下角顯示切換深色模式按鈕,如果不喜歡也可以把它隱藏起來,只有在使用深色模式的使用者進入網站時才會切換,請參考網站提供的程式碼。

如果想調整切換按鈕的位置、顏色和圖示,可在 Options 找到相關程式碼進行微調。
https://free.com.tw/blog/wp-content/uploads/2019/06/2019-06-20_1300.png

頁: [1]
檢視完整版本: 為DZ加入深色模式