use jquery object in togglePopover

This commit is contained in:
Luke Bennett 2018-04-13 18:44:58 +01:00
parent 8d43fe4efe
commit 3283386a1e
No known key found for this signature in database
GPG key ID: A738E9C68D3BF31A

View file

@ -2,12 +2,13 @@ import $ from 'jquery';
import _ from 'underscore';
export function togglePopover(show) {
const isAlreadyShown = this.hasClass('js-popover-show');
const $popover = $(this);
const isAlreadyShown = $popover.hasClass('js-popover-show');
if ((show && isAlreadyShown) || (!show && !isAlreadyShown)) {
return false;
}
this.popover(show ? 'show' : 'hide');
this.toggleClass('disable-animation js-popover-show', show);
$popover.popover(show ? 'show' : 'hide');
$popover.toggleClass('disable-animation js-popover-show', show);
return true;
}