当我将鼠标悬停在类中的元素上时,我希望显示poshytip,但前提是它们满足content函数中指定的条件。如果没有,我不希望出现一个空的气泡。
$('[class~="label"]').poshytip({
slide: false,
followCursor: true,
alignTo: 'cursor',
showTimeout: 0,
hideTimeout: 0,
alignX: 'center',
alignY: 'inner-bottom',
className: 'tip-ihme',
offsetY: 10,
content: function() {
if(this.id.length>25 & sbar.settings.stackBy == 'region') {
return this.id
}
},
liveEvents: true
});
}但是,当我将鼠标放在不符合此规范的元素(即this.id.length<25)上时,仍然会显示一个小的(空的)气泡。有没有办法过滤掉jquery调用中的选择?我尝试了数组风格的过滤:
$('[class~="label"]').filter(function(d) { return d.id.length>25}).poshytip(....谢谢,
发布于 2013-02-28 15:28:24
试试这个:
$('[class~="label"]').each(function(){
if($(this).attr('id').length>25)
{
$(this).poshytip({
// your code
});
}
});https://stackoverflow.com/questions/15129359
复制相似问题