Difference between revisions of "MediaWiki:Common.js"

From Geeetech Wiki
Jump to: navigation, search
(Created page with "var div = document.getElementById("toc"); var toc_height = document.getElementById("toc").offsetHeight; var toc_to_top = document.getElementById("bodyContent").offsetTop; var...")
(No difference)

Revision as of 07:13, 13 September 2022

/usr/lib/python2.7/site-packages/pkg_resources/py2_warn.py:22: UserWarning: Setuptools will stop working on Python 2 ************************************************************ You are running Setuptools on Python 2, which is no longer supported and >>> SETUPTOOLS WILL STOP WORKING <<< in a subsequent release (no sooner than 2020-04-20). Please ensure you are installing Setuptools using pip 9.x or later or pin to `setuptools<45` in your environment. If you have done those things and are still encountering this message, please comment in https://github.com/pypa/setuptools/issues/1458 about the steps that led to this unsupported combination. ************************************************************ sys.version_info < (3,) and warnings.warn(pre + "*" * 60 + msg + "*" * 60)
var div = document.getElementById("toc");
var toc_height = document.getElementById("toc").offsetHeight;
var toc_to_top = document.getElementById("bodyContent").offsetTop;
var toc_scroll_top = toc_height + toc_to_top + 20;

window.onscroll = function() {
  var scrollTop = document.documentElement.scrollTop || document.body.scrollTop;
  if(scrollTop > toc_scroll_top){
    document.getElementById('toc').style.position = 'fixed';
  } else {
    document.getElementById('toc').style.position = '';
  }
}