diff --git a/dom/修改平台logo.md b/dom/修改平台logo.md new file mode 100644 index 0000000..b1942b3 --- /dev/null +++ b/dom/修改平台logo.md @@ -0,0 +1,29 @@ +# 修改平台LOGO +## js +``` +// 顶部区域shortcut为"dec.header" +BI.Plugin.registerObject("dec.header", function (widget) { +// 取到logo对应的dom元素 +var logo = widget.element.find("img"); +// 添加类名 +logo.addClass("plugin-logo"); +}); +``` +## css +``` +.plugin-logo { + cursor: pointer; + transform: rotate(0deg); + transition: transform .3s ease; +} + +.plugin-logo:hover { + width: 30px !important; + height: 30px !important; + transform: rotate(180deg); + transition: transform .3s ease; +} +``` + +## 效果 +![](../screenshorts/1.gif) \ No newline at end of file diff --git a/dom/修改平台标题.md b/dom/修改平台标题.md new file mode 100644 index 0000000..65419b5 --- /dev/null +++ b/dom/修改平台标题.md @@ -0,0 +1,22 @@ +# 修改平台标题 +js +``` +// 顶部区域shortcut为"dec.header" +BI.Plugin.registerObject("dec.header", function (widget) { + // 创建一个标签 + var link = $("点击跳转到w3school"); + // 替换掉平台原有文字标题 + var left = widget.element.children(); + link.replaceAll(left.children()[1]); +}); +``` + +css +``` +.plugin-title { + font-size: 20px; + display: block; + text-decoration: none; + color: bisque; +} +``` \ No newline at end of file diff --git a/dom/增加一个footer.md b/dom/增加一个footer.md new file mode 100644 index 0000000..0dede90 --- /dev/null +++ b/dom/增加一个footer.md @@ -0,0 +1,30 @@ +# 增加一个footer +## js +``` +// 为平台增加一个footer +BI.Plugin.registerObject("dec.app", function (widget) { + // 首先创建一个footer + var footer = $("
Copyright © 2006-2019 Fanruan.
"); + footer.css({ + position: "absolute", + bottom: 0, + left: 0, + right: 0, + height: 30, + backgroundColor: "#2C3D59", + color: "white", + textAlign: "center" + }); + // 添加到页面中 + widget.element.append(footer); + + // 将主内容区的bottom值设为30 + var mainContent = widget.element.children().eq(0); + mainContent.css({ + bottom: 30 + }); +}); +``` + +## 效果预览 +![](../screenshorts/2.png) \ No newline at end of file diff --git a/dom/隐藏侧边栏.md b/dom/隐藏侧边栏.md new file mode 100644 index 0000000..a3445c5 --- /dev/null +++ b/dom/隐藏侧边栏.md @@ -0,0 +1,12 @@ +# 隐藏侧边栏 +## js +``` +// 首先把侧栏隐藏掉 +BI.Plugin.registerObject("dec.menu", function (widget) { + widget.element.hide(); +}); +// 然后再把body的left值设为0 +BI.Plugin.registerObject("dec.body", function (widget) { + widget.element.css("left", 0); +}); +``` \ No newline at end of file diff --git a/screenshorts/1.gif b/screenshorts/1.gif new file mode 100644 index 0000000..4861b66 Binary files /dev/null and b/screenshorts/1.gif differ diff --git a/screenshorts/2.png b/screenshorts/2.png new file mode 100644 index 0000000..ac1f8a7 Binary files /dev/null and b/screenshorts/2.png differ