mirror of
https://github.com/webbukkit/dynmap.git
synced 2025-04-18 18:05:57 +02:00
Add scrolling support for world list
This commit is contained in:
parent
ab963fca70
commit
de94712fbd
@ -533,6 +533,10 @@
|
|||||||
overflow:hidden;
|
overflow:hidden;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.worldlist {
|
||||||
|
overflow:hidden;
|
||||||
|
}
|
||||||
|
|
||||||
/*******************
|
/*******************
|
||||||
* players on the map
|
* players on the map
|
||||||
*/
|
*/
|
||||||
|
@ -176,12 +176,39 @@ DynMap.prototype = {
|
|||||||
}
|
}
|
||||||
if(!nopanel)
|
if(!nopanel)
|
||||||
sidebar.appendTo(container);
|
sidebar.appendTo(container);
|
||||||
|
|
||||||
|
// World scrollbuttons
|
||||||
|
var upbtn_world = $('<div/>')
|
||||||
|
.addClass('scrollup')
|
||||||
|
.bind('mousedown mouseup', function(event){
|
||||||
|
if(event.type == 'mousedown'){
|
||||||
|
worldlist.animate({"scrollTop": "-=300px"}, 3000, 'linear');
|
||||||
|
}else{
|
||||||
|
worldlist.stop();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
var downbtn_world = $('<div/>')
|
||||||
|
.addClass('scrolldown')
|
||||||
|
.bind('mousedown mouseup', function(event){
|
||||||
|
if(event.type == 'mousedown'){
|
||||||
|
worldlist.animate({"scrollTop": "+=300px"}, 3000, 'linear');
|
||||||
|
}else{
|
||||||
|
worldlist.stop();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
// Worlds
|
// Worlds
|
||||||
var worldlist;
|
var worldlist;
|
||||||
$('<fieldset/>')
|
$('<fieldset/>')
|
||||||
.append($('<legend/>').text('Map Types'))
|
.append($('<legend/>').text('Map Types'))
|
||||||
.append(me.worldlist = worldlist = $('<ul/>').addClass('worldlist'))
|
.append(upbtn_world)
|
||||||
|
.append(me.worldlist = worldlist = $('<ul/>').addClass('worldlist')
|
||||||
|
.bind('mousewheel', function(event, delta){
|
||||||
|
this.scrollTop -= (delta * 10);
|
||||||
|
event.preventDefault();
|
||||||
|
})
|
||||||
|
)
|
||||||
|
.append(downbtn_world)
|
||||||
.appendTo(panel);
|
.appendTo(panel);
|
||||||
|
|
||||||
$.each(me.worlds, function(index, world) {
|
$.each(me.worlds, function(index, world) {
|
||||||
@ -250,6 +277,16 @@ DynMap.prototype = {
|
|||||||
.appendTo(panel);
|
.appendTo(panel);
|
||||||
|
|
||||||
var updateHeight = function() {
|
var updateHeight = function() {
|
||||||
|
if(sidebar.innerHeight() > (2*worldlist.scrollHeight())) { /* Big enough */
|
||||||
|
worldlist.height(worldlist.scrollHeight());
|
||||||
|
upbtn_world.toggle(false);
|
||||||
|
downbtn_world.toggle(false);
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
worldlist.height(sidebar.innerHeight() / 2);
|
||||||
|
upbtn_world.toggle(true);
|
||||||
|
downbtn_world.toggle(true);
|
||||||
|
}
|
||||||
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
|
||||||
var scrollable = playerlist.scrollHeight() > playerlist.height();
|
var scrollable = playerlist.scrollHeight() > playerlist.height();
|
||||||
upbtn.toggle(scrollable);
|
upbtn.toggle(scrollable);
|
||||||
|
Loading…
Reference in New Issue
Block a user