Browse Source

update

master
dailer 6 years ago
parent
commit
1395b04ed0
  1. 29
      dom/修改平台logo.md
  2. 22
      dom/修改平台标题.md
  3. 30
      dom/增加一个footer.md
  4. 12
      dom/隐藏侧边栏.md
  5. BIN
      screenshorts/1.gif
  6. BIN
      screenshorts/2.png

29
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)

22
dom/修改平台标题.md

@ -0,0 +1,22 @@
# 修改平台标题
js
```
// 顶部区域shortcut为"dec.header"
BI.Plugin.registerObject("dec.header", function (widget) {
// 创建一个<a>标签
var link = $("<a class='plugin-title' href=\"http://www.w3school.com.cn\">点击跳转到w3school</a>");
// 替换掉平台原有文字标题
var left = widget.element.children();
link.replaceAll(left.children()[1]);
});
```
css
```
.plugin-title {
font-size: 20px;
display: block;
text-decoration: none;
color: bisque;
}
```

30
dom/增加一个footer.md

@ -0,0 +1,30 @@
# 增加一个footer
## js
```
// 为平台增加一个footer
BI.Plugin.registerObject("dec.app", function (widget) {
// 首先创建一个footer
var footer = $("<div class=\"plugin-footer\">Copyright © 2006-2019 Fanruan. </div>");
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)

12
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);
});
```

BIN
screenshorts/1.gif

Binary file not shown.

After

Width:  |  Height:  |  Size: 56 KiB

BIN
screenshorts/2.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 33 KiB

Loading…
Cancel
Save