Merge "De-duplicate pages in replaceInternal"
[mediawiki.git] / resources / src / jquery / jquery.footHovzer.js
blobde745c3360fd02ad9ab7185c27399c5b7cfeccc2
1 /**
2 * @class jQuery.plugin.footHovzer
3 */
4 ( function ( $ ) {
5 var $hovzer, footHovzer, prevHeight, newHeight;
7 function getHovzer() {
8 if ( $hovzer === undefined ) {
9 $hovzer = $( '<div id="jquery-foot-hovzer"></div>' ).appendTo( 'body' );
11 return $hovzer;
14 /**
15 * Utility to stack stuff in an overlay fixed on the bottom of the page.
17 * Usage:
19 * var hovzer = $.getFootHovzer();
20 * hovzer.$.append( $myCollection );
21 * hovzer.update();
23 * @static
24 * @inheritable
25 * @return {jQuery.footHovzer}
27 $.getFootHovzer = function () {
28 footHovzer.$ = getHovzer();
29 return footHovzer;
32 /**
33 * @private
34 * @class jQuery.footHovzer
36 footHovzer = {
38 /**
39 * @property {jQuery} $ The stack container
42 /**
43 * Update dimensions of stack to account for changes in the subtree.
45 update: function () {
46 var $body;
48 $body = $( 'body' );
49 if ( prevHeight === undefined ) {
50 prevHeight = getHovzer().outerHeight( /* includeMargin = */ true );
51 $body.css( 'paddingBottom', '+=' + prevHeight + 'px' );
52 } else {
53 newHeight = getHovzer().outerHeight( true );
54 $body.css( 'paddingBottom', ( parseFloat( $body.css( 'paddingBottom' ) ) - prevHeight ) + newHeight );
56 prevHeight = newHeight;
61 /**
62 * @class jQuery
63 * @mixins jQuery.plugin.footHovzer
66 }( jQuery ) );