// setup everything when document is ready jQuery(document).ready(function($) { // connect to hover event of in .livelinks $('.livelinks a, .widget_links a').hover(function(e) { $(this).append('
'); // get coordinates var mouseX = e.pageX || (e.clientX ? e.clientX + document.body.scrollLeft: 0); var mouseY = e.pageY || (e.clientY ? e.clientY + document.body.scrollTop: 0); // offset them a little mouseX += -260; mouseY += 5; // position our div $('#lb_popup').css({ left: mouseX + "px", top: mouseY + "px" }); $.ajax({ type: "GET", url: 'http://www.shbs.ch/wp-content/plugins/live-blogroll/wp-live-blogroll-ajax.php', timeout: 3000, data: { link_url: this.href, _ajax_nonce: '8319196e66' }, success: function(msg) { jQuery('#lb_popup').html(msg); jQuery('#lb_popup').fadeIn(300); jQuery('#ul.blogroll li a:hover').css('cursor', 'default'); }, error: function(msg) { //jQuery('#lb_popup').html('Error: ' + msg.responseText); } }) }, // when the mouse hovers out function() { // fade out the div $('#lb_popup').fadeOut(100); $('#ul.blogroll li a:hover').css('cursor', 'default'); // remove it $(this).children().remove(); }); });