我有以下使用qtip库创建一个JavaScript弹出的JavaScript。我不确定如何访问集合中的哪个li元素被点击。 这可能吗?我在下面的代码中添加了一个警告框来帮助解释问题。需要帮助请叫我! 非常感谢,jquery popup需要知道哪个元素导致事件
$('li').each(function() {
$(this).qtip(
{
content: {
text: 'test text',
title: { text: true, button: '<img src="/Images/close.gif">' }
},
position: {
corner: {
target: 'rightMiddle',
tooltip: 'leftMiddle'
},
adjust: {
screen: true
}
},
show: {
when: 'click',
solo: true
},
api: {
beforeShow: function(index) {
if(document.getElementById('basketCheck')) {
alert('what LI caused this click?');
return false;
}
}
},
hide: 'unfocus',
style: {
tip: true,
border: {
width: 0,
radius: 4,
},
width: 264,
height: 195,
title: {
background: '#ffffff'
},
lineHeight: '16px'
}
})
});
作为一个说明,对于'beforeShow'传递一个事件作为参数的回调函数;称'索引'没有意义。 – 2012-08-02 10:02:23