当前位置:网站首页>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%;
边栏推荐
- JMM 最最最核心的概念:Happens-before 原则
- The extra points and sharp tools are worthy of the trust | know that Chuangyu won the letter of thanks from the defense side of the attack and defense drill!
- Development specification - parameter verification exception, exception return prompt section
- 别再乱用了,这才是 @Validated 和 @Valid 的真正区别!!!
- Based on the codeless platform, users deeply participated in the construction, and digital data + Nanjing Fiberglass Institute jointly built a national smart laboratory solution
- High level application of SQL statements in MySQL database (II)
- 2022-06-10 工作记录--JS-获取到某一日期N天后的日期
- Research Report on terahertz imaging system industry - market status analysis and development prospect forecast
- win10或win11打印机无法打印
- [WSL] SSH Remote Connection and host port forwarding configuration
猜你喜欢
随机推荐
【Mongodb】READ_ ME_ TO_ RECOVER_ YOUR_ Data, the database is deleted maliciously
2022年高处安装、维护、拆除考试模拟100题及模拟考试
[Software Engineering] key points at the end of the period
The difference between get and post
Database transaction Transanction
Servlet
Learn more about the practical application of sentinel
Solution to the login error of tangdou people
find your present (2)
AttacKG: Constructing Technique Knowledge Graph from Cyber Threat Intelligence Reports代码复现
2022-06-10 工作记录--JS-获取到某一日期N天后的日期
EPICS记录参考4--所有输入记录都有的字段和所有输出记录都有的字段
Vulnhub Vegeta: 1
Rip protocol of dynamic routing protocol
[postgraduate entrance examination English] prepare for 2023, learn list9 words
JMM 最最最核心的概念:Happens-before 原则
How to integrate Huawei cloud function services in fluent
Tetris
Leetcode algorithm The first common node of two linked lists
China solar window market trend report, technical dynamic innovation and market forecast









