hovercard: fix hover-card does now working with ajax loaded content

This commit is contained in:
rabuzarus 2016-05-06 20:48:12 +02:00
parent 0ab7a210f9
commit 415c36e4bb
1 changed files with 71 additions and 79 deletions

View File

@ -8,13 +8,10 @@
*
*/
$(document).ready(function(){
// Elements with the class "userinfo" will get a hover-card.
// Note that this elements does need a href attribute which links to
// a valid profile url
$('.userinfo').on("mouseover", function(e) {
$("body").on("mouseover", ".userinfo", function(e) {
var timeNow = new Date().getTime();
removeAllhoverCards(e,timeNow);
var hoverCardData = false;
@ -81,7 +78,7 @@ $(document).ready(function(){
}
}
}, 500);
}).on("mouseleave", function(e) { // action when mouse leaves the hover-card
}).on("mouseleave", ".userinfo", function(e) { // action when mouse leaves the hover-card
var timeNow = new Date().getTime();
// copy the original title to the title atribute
var title = $(this).attr("data-orig-title");
@ -89,11 +86,6 @@ $(document).ready(function(){
removeAllhoverCards(e,timeNow);
});
});
// hover cards should be removed very easily, e.g. when any of these events happen
$('body').on("mouseleave touchstart scroll click dblclick mousedown mouseup submit keydown keypress keyup", function(e){
var timeNow = new Date().getTime();