嗨我一直在努力让这个脚本http://jsbin.com/ipajo5/工作,但使用.live()而不是.each(),因为html表是即时填充的.
$(document).ready(function() {
$('.bi').each(function () {
// options
var distance = 10;
var time = 250;
var hideDelay = 500;
var hideDelayTimer = null;
var beingShown = false;
var shown = false;
var trigger = $('.tt', this);
var popup = $('.popup', this).css('opacity', 0);
// set the mouseover and mouseout on both element
$([trigger.get(0), popup.get(0)]).mouseover(function () {
if (hideDelayTimer) clearTimeout(hideDelayTimer);
if (beingShown || shown) {
return;
} else {
beingShown = true;
popup.css({
top: $(this).position().top-150,
left: $(this).position().left-100,
display: 'block' …Run Code Online (Sandbox Code Playgroud)