User:Argenti Aertheri/jQuery tweaks.js

From Wikipedia, the free encyclopedia

This is an old revision of this page, as edited by Argenti Aertheri (talk | contribs) at 08:57, 20 April 2024. The present address (URL) is a permanent link to this revision, which may differ significantly from the current revision.

Note: After saving, you have to bypass your browser's cache to see the changes. Google Chrome, Firefox, Microsoft Edge and Safari: Hold down the ⇧ Shift key and click the Reload toolbar button. For details and instructions about other browsers, see Wikipedia:Bypass your cache.
// To Bottom 
$(function() {
	function scrolldown(e) {
		e.preventDefault();
		$('html').animate({scrollTop: $(document).height()});
	}
	function scrollup(e) {
		e.preventDefault();
	//	var scrollBottom = $(document).height() - $(window).height() - $(window).scrollTop();
		$('html').animate({scrollTop: $(document).height() - $(window).height() - $(window).scrollTop()});
	}
	
	$("body").append("<div id='arrow-down'>▲</div>");
	$("#arrow-down").css({
		"font-size": "32px", "bottom":"0", "left": "8px", "position":"fixed","display":"block"
	}).click(scrolldown);
	
	$("body").append("<div id='arrow-up'>▼</div>");
	$("#arrow-up").css({
		"font-size": "32px", "bottom":"40px", "left": "8px", "position":"fixed","display":"block"
	}).click(scrollup);
});