MediaWiki:Common.js:修订间差异
来自勿忘草与永远的少女
跳到导航跳到搜索
无编辑摘要 |
无编辑摘要 标签:已被回退 |
||
| 第1行: | 第1行: | ||
/* | /* ========== 固定顶部导航栏 ========== */ | ||
$(function() { | $(function() { | ||
if ($('.fixed-top-nav').length === 0) { | if ($('.fixed-top-nav').length === 0) { | ||
var navHtml = ` | var navHtml = ` | ||
<div class="fixed-top-nav"> | <div class="fixed-top-nav"> | ||
| 第12行: | 第9行: | ||
</a> | </a> | ||
<div class="nav-links"> | <div class="nav-links"> | ||
<a href=" | <a href="/首页" class="nav-link">📚 首页</a> | ||
<a href="/游戏攻略" class="nav-link">📖 游戏攻略</a> | |||
<a href="/棋子图鉴" class="nav-link">⚔️ 棋子图鉴</a> | |||
<a href="/游戏攻略" class="nav-link"> | <a href="/天赋图鉴" class="nav-link">🗺️ 天赋图鉴</a> | ||
<a href="/装备图鉴" class="nav-link">📊 装备图鉴</a> | |||
<a href="/moniqi/moniqi.html" class="nav-link">📊 阵容模拟器</a> | |||
<a href=" | |||
<a href="/天赋图鉴" class="nav-link"> | |||
<a href="/装备图鉴" class="nav-link"> | |||
<a href="moniqi/moniqi.html" class="nav-link"> | |||
</div> | </div> | ||
</div> | </div> | ||
`; | `; | ||
$('body').prepend(navHtml); | $('body').prepend(navHtml); | ||
$(window).scroll(function() { | $(window).scroll(function() { | ||
if ($(window).scrollTop() > 50) { | if ($(window).scrollTop() > 50) { | ||
| 第48行: | 第30行: | ||
}); | }); | ||
/* ========== 固定页脚底部边距自适应 ========== */ | |||
$(function() { | $(function() { | ||
function adjustFooterPadding() { | |||
var footer = $('#footer, .mw-footer'); | |||
if (footer.length > 0) { | |||
var footerHeight = footer.outerHeight(); | |||
$('body').css('padding-bottom', footerHeight + 20 + 'px'); | |||
} | |||
} | |||
adjustFooterPadding(); | |||
$(window).resize(adjustFooterPadding); | |||
}); | }); | ||
/* ========== 首页侧边栏高度对齐 ========== */ | |||
$(function() { | $(function() { | ||
function adjustSidebarHeight() { | function adjustSidebarHeight() { | ||
var leftHeight = $('.custom-homepage .left-column').outerHeight(); | var leftHeight = $('.custom-homepage .left-column').outerHeight(); | ||
| 第79行: | 第51行: | ||
if (rightHeight < leftHeight && $(window).width() > 768) { | if (rightHeight < leftHeight && $(window).width() > 768) { | ||
$('.custom-homepage .right-column').css('min-height', leftHeight); | $('.custom-homepage .right-column').css('min-height', leftHeight); | ||
} else { | |||
$('.custom-homepage .right-column').css('min-height', ''); | |||
} | } | ||
} | } | ||
setTimeout(adjustSidebarHeight, 500); | setTimeout(adjustSidebarHeight, 500); | ||
$(window).resize(adjustSidebarHeight); | $(window).resize(adjustSidebarHeight); | ||
}); | }); | ||
2026年3月28日 (六) 23:31的版本
/* ========== 固定顶部导航栏 ========== */
$(function() {
if ($('.fixed-top-nav').length === 0) {
var navHtml = `
<div class="fixed-top-nav">
<a href="/首页" class="nav-logo">
<img src="/wikibg/logo.jpg" alt="网站Logo">
<span>万华镜</span>
</a>
<div class="nav-links">
<a href="/首页" class="nav-link">📚 首页</a>
<a href="/游戏攻略" class="nav-link">📖 游戏攻略</a>
<a href="/棋子图鉴" class="nav-link">⚔️ 棋子图鉴</a>
<a href="/天赋图鉴" class="nav-link">🗺️ 天赋图鉴</a>
<a href="/装备图鉴" class="nav-link">📊 装备图鉴</a>
<a href="/moniqi/moniqi.html" class="nav-link">📊 阵容模拟器</a>
</div>
</div>
`;
$('body').prepend(navHtml);
$(window).scroll(function() {
if ($(window).scrollTop() > 50) {
$('.fixed-top-nav').addClass('scrolled');
} else {
$('.fixed-top-nav').removeClass('scrolled');
}
});
}
});
/* ========== 固定页脚底部边距自适应 ========== */
$(function() {
function adjustFooterPadding() {
var footer = $('#footer, .mw-footer');
if (footer.length > 0) {
var footerHeight = footer.outerHeight();
$('body').css('padding-bottom', footerHeight + 20 + 'px');
}
}
adjustFooterPadding();
$(window).resize(adjustFooterPadding);
});
/* ========== 首页侧边栏高度对齐 ========== */
$(function() {
function adjustSidebarHeight() {
var leftHeight = $('.custom-homepage .left-column').outerHeight();
var rightHeight = $('.custom-homepage .right-column').outerHeight();
if (rightHeight < leftHeight && $(window).width() > 768) {
$('.custom-homepage .right-column').css('min-height', leftHeight);
} else {
$('.custom-homepage .right-column').css('min-height', '');
}
}
setTimeout(adjustSidebarHeight, 500);
$(window).resize(adjustSidebarHeight);
});