当前位置:网站首页>Dynamic menu, auto align
Dynamic menu, auto align
2022-06-24 22:57:00 【Gaobin】
describe : Similar to the menu style of wechat official account , The number of submenus dynamically generated is not fixed , The style is as follows :

html
<nav class="wx_menu">
<dl>
<dt> SMS / postage </dt>
<dd>
<ul class="dropdown-menu">
<li><a href="/wx/m/sms"> SMS </a></li>
<li><a href="/wx/m/data"> Traffic </a></li>
<li><a href="/wx/m/price"> postage </a></li>
<li><a href="/wx/m/partner"> partner </a></li>
</ul>
</dd>
</dl>
<dl>
<dt>
Extension / exchange
</dt>
<dd>
<ul class="dropdown-menu">
<li><a href="/wx/m/partner_plan"> Introduction to integral </a></li>
<li><a href="/WX/m/Extension/@ViewBag.MySharedInfo"> Promote members </a></li>
<li><a href="/wx/wx_jfdd/shop"> Exchange gifts </a></li>
<li><a href="/wx/WX_FXJL/exshare"> Redeem points </a></li>
</ul>
</dd>
</dl>
<dl>
<dt> my </dt>
<dd>
<ul class="dropdown-menu">
<li><a href="/wx/WX_JFJL/myscore"> integral </a></li>
<li><a href="/wx/WX_FXJL/myshare"> Shared value </a></li>
<li><a href="/WX/WX_HHR/mymember"> members </a></li>
<li><a href="/WX/WX_HHR/myinfo"> Information </a></li>
<li><a href="/WX/WX_HHR/myaddress"> Mailing address </a></li>
</ul>
</dd>
</dl>
</nav>
css(less)
.wx_menu {
width: 100%;
position: fixed;
bottom: 0;
left: 0;
right: 0;
margin: auto;
z-index: 200000;
background-color: transparent;
text-align: center;
dl {
background-color: #fff;
border: solid 1px #ddd9d9;
text-align: center;
padding: 10px 0;
margin-bottom: 4px;
position: relative;
display: inline-block;
width: 30%;
dd {
display: none;
width: 100%;
margin: 0 0 6px 0;
padding: 0;
transition: 1s;
animation: flipInX,.4s,1;
position: absolute;
top: auto;
bottom: 100%;
}
}
ul {
display: block;
width: 100%;
margin: 0;
padding: 0;
box-shadow: 0,2px,4px,#000;
li {
display: block;
padding: 12px 0;
text-align: center;
background-color: #fff;
width: 100%;
box-sizing: border-box;
border: 1px solid #e0e0e0;
}
li:not(:last-child) {
border-bottom: none;
}
}
}
js
$(function () {
$(".wx_menu").find("dt").click(function () {
var _obj = $(this);
if (_obj.next("dd").css("display") == "block") {
_obj.next("dd").css({ "display": "none" });
} else {
_obj.next("dd").css({ "display": "block" }).parent().siblings().find("dd").hide();
}
});
});This example is the bottom alignment , The key style is : top: auto;bottom: 100%;
边栏推荐
- Servlet
- See how sparksql supports enterprise level data warehouse
- China solar window market trend report, technical dynamic innovation and market forecast
- Chapter 10 project stakeholder management
- Leetcode algorithm The first common node of two linked lists
- 证件照处理
- Solve the problem of port occupation
- Future development of education industry of e-commerce Express
- 「ARM 架构」是一种怎样的处理器架构?
- Stop using it indiscriminately. This is the real difference between @validated and @valid!!!
猜你喜欢

【Laravel系列7.9】测试

2022安全员-B证考试题库及答案

vulnhub Vegeta: 1

Analyze the implementation process of oauth2 distributed authentication and authorization based on the source code

ThreadLocal memory leak

Memory alignment of structures
![[QT] QT event handling](/img/48/14a5491307fee1c99434d6cb308337.jpg)
[QT] QT event handling

EPICS记录参考2--EPICS过程数据库概念

京东618会议平板排行榜公布,新锐黑马品牌会参谋角逐前三名,向国货老大华为学习

关于某手滑块的一些更新(6-18,js逆向)
随机推荐
Future development of education industry of e-commerce Express
Cat write multiline content to file
2022年安全员-A证考题及答案
【軟件工程】期末重點
【Laravel系列7.9】测试
是否需要提高代码阅读能力?这有技巧
Data communication foundation - Ethernet port mirroring and link aggregation
2022安全员-B证考试题库及答案
Beijiafu (p+f) R2000 modified radar IP
MySQL + JSON = King fried!!
Principle of IP routing
结构体的内存对齐
2022-06-10 工作记录--JS-获取到某一日期N天后的日期
MySQL夺命10问,你能坚持到第几问?
China smallpox vaccine market trend report, technical innovation and market forecast
JMM 最最最核心的概念:Happens-before 原则
find your present (2)
Row and column differences in matrix construction of DX HLSL and GL glsl
ThreadLocal memory leak
倍加福(P+F)R2000修改雷达IP