User:Rezonansowy/js/TOC-fixed.js
// tocLeft is the table of contents that I want to fix in place on the left margin
// after the user has scrolled down below the standard mediawiki menu
$(function(){
// create the nav id="tocLeft" where the fixed menu will appear
// the css will control it's appearance
$("#mw-panel").append("");
// hide tocLeft until we need it.
$("#tocLeft").hide();
// display tocLeft when the user scrolls below the standard mediawiki menu
$(window).scroll(function(){
if ($(this).scrollTop() >= 550) {
$("#tocLeft").fadeIn();
} else {
$("#tocLeft").fadeOut();
}
});
// #toc is generated by mediawiki software and it contains the table of contents
var toc=$("#toc");
// put the table of contents into tocLeft
$("#tocLeft").html(toc.html());
// get rid of the bullets in the
$("ul","#tocLeft").addClass("ulNoBullets");
// set the height to match the window height
$("#tocLeft").height($(window).height()-30);
$(".toctoggle","#tocLeft").hide();
// when the user resizes the window - resize tocLeft
$(window).resize(function() {
$("#tocLeft").height($(window).height()-30);
});
importStylesheet('User:Rezonansowy/TOC-fixed.css');
});