MediaWiki:Common.js: Difference between revisions
No edit summary |
No edit summary |
||
| Line 1,414: | Line 1,414: | ||
}); | }); | ||
/*-----------------------------------------01-07-2026-------------------------------------------*/ | /*-----------------------------------------01-07-2026-------------------------------------------*/ | ||
/* Make WikiEditor toolbar sticky below Ekatra toolbar */ | /* Make WikiEditor toolbar sticky below the Ekatra toolbar */ | ||
$(function () { | $(function () { | ||
function | function makeWikiToolbarSticky() { | ||
var $toolbar = $('.wikiEditor-ui-top'); | var $toolbar = $('.wikiEditor-ui-top'); | ||
var $ | var $ekatraToolbar = $('#editpage-specialchars'); | ||
if (!$toolbar.length || !$ | // Stop if either toolbar doesn't exist | ||
if (!$toolbar.length || !$ekatraToolbar.length) { | |||
return; | return; | ||
} | } | ||
// Place the WikiEditor toolbar below the Ekatra toolbar | |||
$toolbar.css({ | $toolbar.css({ | ||
position: 'sticky', | position: 'sticky', | ||
top: $ | top: $ekatraToolbar.outerHeight() + 'px', | ||
zIndex: 999, | zIndex: 999, | ||
background: '#fff' | background: '#fff' | ||
| Line 1,433: | Line 1,435: | ||
} | } | ||
// Wait | // Wait for WikiEditor to finish loading | ||
setTimeout(makeWikiToolbarSticky, 300); | |||
// Update position if window size changes | |||
$(window).on('resize', makeWikiToolbarSticky); | |||
}); | }); | ||