Search code examples
csspopoversemantic-ui

Semantic UI- can't get popover to work on table rows


I'm having a heck of a time getting popovers to cooperate in Semantic UI. I have a basic table in a sidebar, and I need to display a popover whenever someone hovers over a table row. Seems basic enough but I can't for the life of me get it to work.

Typically in Semantic you embed the popover's HTML right next to the affected element as a sibling. Then you call

$(".user-popover").popup({
    position: 'right center'
});

For whatever reason, my popover won't appear. Can anyone help me out?

https://jsfiddle.net/edfdqzbw/1/


Solution

  • According to documentation:

    If its not possible to include the popup content as the next sibling, you can also specify a custom selector to help link the popup contents to its activator.

    Hence:

    $(function () {
        $(".user-popover").popup({
            hoverable: true,
            popup : $('.popup'),
            position: 'right center',
            lastResort: 'right center'
        });
    });
    

    DEmo: https://jsfiddle.net/edfdqzbw/3/ (see that next sibling is actually <tr>, that was problem)