Bug 18066: Fix map positioning in admin/usage_statistics.pl
Signed-off-by: Julian Maurice <julian.maurice@biblibre.com> Signed-off-by: Brendan A Gallagher <brendan@bywatersolutions.com>
This commit is contained in:
parent
7aff869661
commit
c3db243ad4
1 changed files with 24 additions and 19 deletions
|
@ -10,28 +10,32 @@
|
|||
|
||||
<script type="text/javascript">
|
||||
//<![CDATA[
|
||||
var originalOffset;
|
||||
$(window).scroll(function () {
|
||||
function positionMap() {
|
||||
var tbh = $("#mapid");
|
||||
var offsetTop = tbh.offset().top;
|
||||
var mapContainer = tbh.parent();
|
||||
mapContainer.css('position', 'relative');
|
||||
mapContainer.css('min-height', tbh.outerHeight(true));
|
||||
tbh.css('position', 'absolute');
|
||||
tbh.css('right', 0);
|
||||
|
||||
var offsetTop = mapContainer.offset().top;
|
||||
var s = parseInt($(window).scrollTop(), 10);
|
||||
var fixMe = (s > offsetTop);
|
||||
if ( !originalOffset ) originalOffset = tbh.position().top;
|
||||
var repositionMe = (s < originalOffset);
|
||||
if (fixMe) {
|
||||
tbh.css({
|
||||
'position': 'fixed',
|
||||
'top': '0',
|
||||
'margin-left': '40%'
|
||||
});
|
||||
}
|
||||
if (repositionMe) {
|
||||
tbh.css({
|
||||
'position': 'absolute',
|
||||
'top': originalOffset,
|
||||
'margin-left': '40%'
|
||||
});
|
||||
tbh.css('top', '').css('bottom', '');
|
||||
if (s > offsetTop) {
|
||||
var mapContainerOffsetBottom = offsetTop + mapContainer.innerHeight();
|
||||
if (s + tbh.outerHeight(true) > mapContainerOffsetBottom) {
|
||||
tbh.css('bottom', 0);
|
||||
} else {
|
||||
tbh.css('top', s - offsetTop);
|
||||
}
|
||||
} else {
|
||||
tbh.css('top', 0);
|
||||
}
|
||||
}
|
||||
|
||||
$(document).ready(function() {
|
||||
$(window).scroll(positionMap);
|
||||
positionMap();
|
||||
});
|
||||
//]]>
|
||||
</script>
|
||||
|
@ -321,6 +325,7 @@
|
|||
$("#UsageStatsLibrariesInfo").on('change', function(){
|
||||
if ( $(this).val() == 1 ) $("#libraries_info").show()
|
||||
else $("#libraries_info").hide();
|
||||
positionMap();
|
||||
});
|
||||
|
||||
</script>
|
||||
|
|
Loading…
Reference in a new issue