Question

I want to show poshytips when I mouseover elements in a class, but only if they meet the conditions specified in the content function. If not, I do not want an empty bubble to appear.

$('[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
        });
    }

However, a small (empty) bubble still shows when I mouseover the elements who do not meet this specification (ie, this.id.length<25). Is there a way to filter out the selection in the jquery call? I tried array style filtering:

  $('[class~="label"]').filter(function(d) { return d.id.length>25}).poshytip(....

Thanks,

Was it helpful?

Solution

Try this:

$('[class~="label"]').each(function(){
    if($(this).attr('id').length>25)
    {
        $(this).poshytip({
           // your code
        });
    }
});
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top