mirror of
https://github.com/webbukkit/dynmap.git
synced 2024-10-01 07:07:26 +02:00
Hides scrollbuttons when they are not needed.
This commit is contained in:
parent
79c2989b37
commit
c13517949b
@ -20,6 +20,11 @@ function splitArgs(s) {
|
|||||||
function swtch(value, options, defaultOption) {
|
function swtch(value, options, defaultOption) {
|
||||||
return (options[value] || defaultOption)(value);
|
return (options[value] || defaultOption)(value);
|
||||||
}
|
}
|
||||||
|
(function( $ ){
|
||||||
|
$.fn.scrollHeight = function(height) {
|
||||||
|
return this[0].scrollHeight;
|
||||||
|
};
|
||||||
|
})($);
|
||||||
|
|
||||||
function DynMapType() { }
|
function DynMapType() { }
|
||||||
DynMapType.prototype = {
|
DynMapType.prototype = {
|
||||||
@ -217,10 +222,14 @@ DynMap.prototype = {
|
|||||||
.append(downbtn)
|
.append(downbtn)
|
||||||
.appendTo(panel);
|
.appendTo(panel);
|
||||||
|
|
||||||
|
var updateHeight = function() {
|
||||||
playerlist.height(sidebar.innerHeight() - (playerlist.offset().top - worldlist.offset().top) - 64); // here we need a fix to avoid the static value, but it works fine this way :P
|
playerlist.height(sidebar.innerHeight() - (playerlist.offset().top - worldlist.offset().top) - 64); // here we need a fix to avoid the static value, but it works fine this way :P
|
||||||
$(window).resize(function() {
|
var scrollable = playerlist.scrollHeight() > playerlist.height();
|
||||||
playerlist.height(sidebar.innerHeight() - (playerlist.offset().top - worldlist.offset().top) - 64); // here we need a fix to avoid the static value, but it works fine this way :P
|
upbtn.toggle(scrollable);
|
||||||
});
|
downbtn.toggle(scrollable);
|
||||||
|
};
|
||||||
|
updateHeight();
|
||||||
|
$(window).resize(updateHeight);
|
||||||
|
|
||||||
// The Compass
|
// The Compass
|
||||||
var compass = $('<div/>')
|
var compass = $('<div/>')
|
||||||
@ -490,7 +499,7 @@ DynMap.prototype = {
|
|||||||
|
|
||||||
me.messagelist.show();
|
me.messagelist.show();
|
||||||
//var scrollHeight = jQuery(me.messagelist).attr('scrollHeight');
|
//var scrollHeight = jQuery(me.messagelist).attr('scrollHeight');
|
||||||
var scrollHeight = me.messagelist[0].scrollHeight;
|
var scrollHeight = me.messagelist.scrollHeight();
|
||||||
messagelist.scrollTop(scrollHeight);
|
messagelist.scrollTop(scrollHeight);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
Loading…
Reference in New Issue
Block a user