Jump to content

User:Argenti Aertheri/jQuery tweaks.js

From Wikipedia, the free encyclopedia
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);
});