LLWiki正在建设中,欢迎加入我们

“User:Bhsd/minerva.js”的版本间差异

跳转到导航 跳转到搜索
删除1,396字节 、​ 2021年7月14日 (三) 11:57
overflow和sticky冲突
(// 使用Wikiplus小工具快速编辑)
标签移动版网页编辑 移动版编辑
(overflow和sticky冲突)
标签撤销 移动版网页编辑 移动版编辑
 
// 直接进入讨论页
//$(function() { $('.talk').off( 'click' ).click(function(e) { e.stopImmediatePropagation(); }); });
 
if (mw.config.get( 'wgArticleId' ) == 1521) {
}) ) ).after( $('<li>').append( $('<a>', {href: script + '/Special:版本',
html: '<i class="fa fa-puzzle-piece"></i><span>版本</span>'}) ) );
});
 
var $thead = {};
const tsticky = function() {
if (!$thead.length) { return; }
$thead.each(function() {
$(this).children( 'tr' ).toArray().reduce(function(height, ele, i) {
const $tr = $(ele);
if (i) { $tr.children( 'th' ).css('top', height); }
return height + $tr.height();
}, 0);
});
},
resize = mw.util.debounce(500, tsticky); // 降低不必要的执行频率
$(window).resize( resize );
mw.hook( 'wikipage.content' ).add(function($content) {
$thead = {}; // 立即清空$thead,防止出错
const $table = $content.find( '.wikitable.tsticky.sortable' ),
updateThead = function() {
if ($table.not( '.jquery-tablesorter' ).length) { return; } // 还需要继续等待jquery.tablesorter执行
observer.disconnect();
$thead = $table.children( 'thead' ).filter(function() { return this.childNodes.length > 1; });
tsticky();
},
observer = new MutationObserver( updateThead ); // jshint ignore: line
$table.each(function() { observer.observe(this, {attributes: true, attributeFilter: ['class']}); })
.filter( '.sif-song-table' ).find( 'th:has(.tabs-dropdown)' ).css('z-index', 2);
updateThead(); // 立即尝试更新需要固定的表头
});
});
16,874

个编辑

导航菜单