PageSourceSearch

http://www.histoireaisne.fr/chauny/jquery/LMCenterInWindow.js

js histoireaisne.fr collected 2026-10-02 11:22:32 UTC 1,373 bytes, 31 lines download raw bytes

1/* LMSOFT LMCentreInWindow Plugin
2 * ---------------------------------------------------
3 * Version 1.0 (March 2011)
4 * Author: Luc Carreau (http://lmsoft.com)
5 * ---------------------------------------------------
6 * Centres an element in the centre of the window, both horizontally and vertically. Prevents
7 * content from being positioned off the screen when the content is too large for the window.
8 *
9 */
10
11(function ($) {
12
13    $.fn.LMCentreInWindow = function () {
14		var scrollTop = (document.documentElement && document.documentElement.scrollTop) || window.pageYOffset || self.pageYOffset || document.body.scrollTop;         
15		var scrollLeft = (document.documentElement && document.documentElement.scrollLeft) || window.pageXOffset || self.pageXOffset || document.body.scrollLeft;         
16		var popupHeight = this.height();         
17		var popupWidth = this.width();    
18
19		/* Viewport calculation */         
20		var viewportwidth=$(window).width();
21		var viewportheight=$(window).height();           
22
23		//centering         
24		divtop = viewportheight / 2 - popupHeight / 2 + scrollTop;
25		if(divtop<scrollTop) divtop=scrollTop;
26		divleft = viewportwidth / 2 - popupWidth / 2 + scrollLeft;
27		if(divleft<scrollLeft) divleft=scrollLeft;
28		this.css({'position':'absolute', 'top': divtop +'px', 'left': divleft +'px'}); 
29    };
30})(jQuery);
31

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.