mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/RevisionSlider
synced 2024-11-15 03:33:45 +00:00
Merge "Close tooltips when clicking somewhere outside of them"
This commit is contained in:
commit
ea9c83aa80
|
@ -70,6 +70,7 @@
|
|||
}
|
||||
|
||||
this.keepTooltipsOnHover();
|
||||
this.closeTooltipsOnClick();
|
||||
|
||||
return $html;
|
||||
},
|
||||
|
@ -181,6 +182,21 @@
|
|||
} );
|
||||
},
|
||||
|
||||
/**
|
||||
* Sets an event handler to close tooltips when clicking somewhere outside
|
||||
*/
|
||||
closeTooltipsOnClick: function () {
|
||||
var self = this;
|
||||
|
||||
$( document )
|
||||
.on( 'click', function ( event ) {
|
||||
if ( $( event.target ).closest( '.mw-revslider-revision-tooltip' ).length === 0 &&
|
||||
$( event.target ).closest( '.mw-revslider-revisions-container' ).length === 0 ) {
|
||||
self.hideCurrentTooltip();
|
||||
}
|
||||
} );
|
||||
},
|
||||
|
||||
/**
|
||||
* Generates the HTML for a tooltip that appears on hover above each revision on the slider
|
||||
*
|
||||
|
|
Loading…
Reference in a new issue