You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
44 lines
1.1 KiB
44 lines
1.1 KiB
$(document).ready(function(){ |
|
// This function is executed once the document is loaded |
|
|
|
// Caching the jQuery selectors: |
|
var count = $('.onlineWidget .cnt'); |
|
var panel = $('.onlineWidget .pnl'); |
|
var timeout; |
|
|
|
// Loading the number of users online into the count div: |
|
count.load(aveabspath+'index.php?module=whoisonline&action=online'); |
|
|
|
$('.onlineWidget').hover( |
|
function(){ |
|
// Setting a custom 'open' event on the sliding panel: |
|
|
|
clearTimeout(timeout); |
|
timeout = setTimeout(function(){panel.trigger('open');},500); |
|
}, |
|
function(){ |
|
// Custom 'close' event: |
|
|
|
clearTimeout(timeout); |
|
timeout = setTimeout(function(){panel.trigger('close');},500); |
|
} |
|
); |
|
|
|
var loaded=false; // A flag which prevents multiple ajax calls to geodata.php; |
|
|
|
// Binding functions to custom events: |
|
|
|
panel.bind('open',function(){ |
|
panel.slideDown(function(){ |
|
if(!loaded) |
|
{ |
|
// Loading the countries and the flags once the sliding panel is shown: |
|
panel.load(aveabspath+'index.php?module=whoisonline&action=geodata'); |
|
loaded=true; |
|
} |
|
}); |
|
}).bind('close',function(){ |
|
panel.slideUp(); |
|
}); |
|
|
|
}); |