sydcanem / bootstrap-contextmenu

Context menu plugin for Twitter's Bootstrap framework
http://sydcanem.com/bootstrap-contextmenu/
645 stars 193 forks source link

Popup position is incorrect #98

Open Helen1987 opened 8 years ago

Helen1987 commented 8 years ago

When popup menu is too high to be displayed at a point of mouse click, popup is displayed higher on the height of menu. outerHeight is used to calculate the height of menu when actual content is hided. In such situation there are no guarantee that outerHeight is correct prove

The value reported by .outerHeight() is not guaranteed to be accurate when the element or its parent is hidden. To get an accurate value, ensure the element is visible before using .outerHeight()

In my case outerHeight is slightly incorrect, so position of popup menu is slightly incorrect as well. I believe, it is better to add open class first and then calculate the position:

$menu.addClass('open');
tp = this.getPosition(e, $menu);