Merge "Close tooltips when clicking somewhere outside of them"

This commit is contained in:
jenkins-bot 2016-09-01 12:42:16 +00:00 committed by Gerrit Code Review
commit ea9c83aa80

View file

@ -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
*