mirror of
https://gitee.com/ant-design/ant-design.git
synced 2024-12-03 04:30:06 +08:00
Add prev & next nav
This commit is contained in:
parent
a0ea479108
commit
2be1ac90df
@ -56,6 +56,27 @@ InstantClickChangeFns.push(function() {
|
||||
// 移动 API 文档到演示下方
|
||||
$('.markdown #api').nextAll().andSelf().appendTo('.api-container');
|
||||
|
||||
// 添加上一页下一页
|
||||
if ($('.aside-container li > a').length > 0) {
|
||||
var links = $('.aside-container li > a');
|
||||
var currentLinkIndex = -1;
|
||||
links.each(function(i, item) {
|
||||
if ($(item).parent().hasClass('current')) {
|
||||
currentLinkIndex = i;
|
||||
}
|
||||
});
|
||||
var prevNextNavNode = $('<div class="prev-next-nav"></div>');
|
||||
var prevLink = links[currentLinkIndex - 1];
|
||||
var nextLink = links[currentLinkIndex + 1];
|
||||
if (prevLink) {
|
||||
prevNextNavNode.append('<a href="' + prevLink.href + '">' + prevLink.innerHTML + '</a>');
|
||||
}
|
||||
if (nextLink) {
|
||||
prevNextNavNode.append('<a href="' + nextLink.href + '">' + nextLink.innerHTML + '</a>');
|
||||
}
|
||||
prevNextNavNode.appendTo('.main-container');
|
||||
}
|
||||
|
||||
$('.nav-phone-icon').click(function() {
|
||||
$(this).prev().toggle();
|
||||
});
|
||||
|
Loading…
Reference in New Issue
Block a user