2013-08-14 Koichiro Kikuchi <koichiro@rworks.jp>

* index.php: Improve footer layout.

	MERGED FROM branch_4.0



git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@8663 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
This commit is contained in:
koichirok 2013-08-14 06:46:20 +00:00
parent 66bcb4722b
commit 6847626886
2 changed files with 39 additions and 17 deletions

View File

@ -1,3 +1,9 @@
2013-08-14 Koichiro Kikuchi <koichiro@rworks.jp>
* index.php: Improve footer layout.
MERGED FROM branch_4.0
2013-08-13 Ramon Novoa <rnovoa@artica.es>
* include/help/es/help_snmp_alert_custom.php,

View File

@ -571,33 +571,49 @@ require('include/php_to_js_values.php');
<script type="text/javascript" language="javascript">
//Dynamically assign footer position and width.
//Initial load of page
$(document).ready(adjustFooter);
//Every resize of window
$(window).resize(adjustFooter);
//Every resize (height change) of div#container
container_height = $('#container').height();
$('#container').bind((window.opera ? 'DOMAttrModified' : 'DOMSubtreeModified'), function() {
if (container_height != $('#container').height()) {
container_height = $('#container').height();
adjustFooter();
}
});
//Every show/hide call may need footer re-layout
(function() {
var oShow = jQuery.fn.show;
var oHide = jQuery.fn.hide;
//Dynamically assign height
jQuery.fn.show = function () {
var rv = oShow.apply(this, arguments);
adjustFooter();
return rv;
};
jQuery.fn.hide = function () {
var rv = oHide.apply(this, arguments);
adjustFooter();
return rv;
};
})();
//Dynamically assign footer position and width.
function adjustFooter() {
// highest Y pos for #foot
if (document.readyState !== 'complete') {
return;
}
// minimum top value (upper limit) for div#foot
var ulim = $('#container').position().top + $('#container').outerHeight(true);
// $(window).height() returns wrong value on Opera and Google Chrome.
var wh = $(window).height(); //document.documentElement.clientHeight;
// window height. $(window).height() returns wrong value on Opera and Google Chrome.
var wh = document.documentElement.clientHeight;
// save div#foot's height for latter use
var h = $('#foot').height();
// new top value for div#foot
var t = (ulim + $('#foot').outerHeight() > wh) ? ulim : wh - $('#foot').outerHeight();
$('#foot').css({ position: "absolute", top: t, left: $('#foot').offset().left});
$('#foot').width($(window).width());
$('#foot').height(h);
if ($('#foot').position().top != t) {
$('#foot').css({ position: "absolute", top: t, left: $('#foot').offset().left});
$('#foot').height(h);
}
if ($('#foot').width() != $(window).width()) {
$('#foot').width($(window).width());
}
}
</script>