diff --git a/README.md b/README.md index c6dd5dc..4d8099c 100644 --- a/README.md +++ b/README.md @@ -6,4 +6,5 @@ 2. [修改平台标题](./dom/修改平台标题.md) 3. [增加一个footer](./dom/增加一个footer.md) 4. [隐藏侧边栏](./dom/隐藏侧边栏.md) -5. [侧栏移动到右侧](./dom/侧栏移动到右侧.md) \ No newline at end of file +5. [侧栏移动到右侧](./dom/侧栏移动到右侧.md) +6. [贴底隐藏的侧边栏](./dom/贴底隐藏的侧边栏.md) \ No newline at end of file diff --git a/dom/贴底隐藏的侧边栏.md b/dom/贴底隐藏的侧边栏.md new file mode 100644 index 0000000..9e8f48f --- /dev/null +++ b/dom/贴底隐藏的侧边栏.md @@ -0,0 +1,54 @@ +# 贴底隐藏的侧边栏 +## js +``` +// 贴底隐藏的侧边栏 +BI.Plugin.registerObject("dec.body", function (widget) { + // 首先去掉主内容区的left值 + widget.element.css({ + left: 0 + }); +}); +BI.Plugin.registerObject("dec.menu", function (widget) { + // 去掉menu的top值,bottom设置为0 + widget.element.css({ + top: "", + left: "30%", + right: "30%", + bottom: 0, + height: "10px", + width: "auto", + position: "fixed", + zIndex: 1000000 + }); + // 绑定hover事件 + widget.element.hover(function () { + widget.element.animate({height: "70px"}); + }, function () { + widget.element.animate({height: "10px"}); + }); + + // 讲容纳menu的容器变为flex盒子 + var wrapper = widget.element.children(); + wrapper.css({ + display: "flex", + justifyContent: "space-around" + }); + + // 调整一下位置 + var children = widget.element.find(".dec-menu-button"); + children.each(function (index, button) { + $(button).css({ + marginTop: -10 + }); + }); +}); + +BI.Plugin.registerObject("dec.menu.button", function (widget) { + // 移除menu状态线 + var line = widget.element.children(".menu-button-line"); + line.remove(); +}); +``` + +## 效果预览 +![](../screenshorts/4.gif) \ No newline at end of file diff --git a/screenshorts/4.gif b/screenshorts/4.gif new file mode 100644 index 0000000..d644605 Binary files /dev/null and b/screenshorts/4.gif differ