Skip to content

Instantly share code, notes, and snippets.

@reachkamrul
Created September 27, 2021 11:56
Show Gist options
  • Save reachkamrul/ae8378cf630357bb87bcb0ad48d26418 to your computer and use it in GitHub Desktop.
Save reachkamrul/ae8378cf630357bb87bcb0ad48d26418 to your computer and use it in GitHub Desktop.
function addDom() {
$table.find("tbody td").each(function () {
if ($(this).find(".pop-up").length) {
// it exists do nothing
} else {
var content = jQuery(this).text();
if (jQuery.trim(jQuery(this).html()) !== "") {
jQuery("<p class='pop-up'></p>").appendTo(jQuery(this));
if (jQuery.trim(jQuery(this).find(".pop-up").html()) === "") {
jQuery(this).find(".pop-up").html(content);
}
}
}
});
}
function showData() {
jQuery("tbody td").mouseover(function (e) {
jQuery(this).find(".pop-up").show();
});
jQuery("tbody td").mouseout(function (e) {
jQuery("tbody td .pop-up").hide();
});
jQuery("tbody td").mousemove(function (e) {
var moveLeft = 100;
var moveDown = 100;
jQuery(this)
.find(".pop-up")
.css("top", e.pageY - moveDown)
// .css("left", e.pageX - moveLeft);
});
}
jQuery(document).ready(function () {
addDom();
showData();
});
$table.on("after.ft.filtering", function () {
addDom();
showData();
});
$table.on("after.ft.paging", function () {
addDom();
showData();
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment