tryout to automate stop events on popups

This commit is contained in:
nglk 2020-10-27 15:04:38 +01:00
parent 9f8a09f9c9
commit f5ef7ef386

46
static/js/d3_map.js vendored
View File

@ -28,7 +28,7 @@ d3.json("/static/js/group1.json", function(error, json) {
var node = svg.selectAll(".node")
.data(json.nodes)
.enter().append("g")
.enter().append("g")
.attr("class", "node ")
// .node()classList.add(function(d){return d.group});
.attr("id", function(d){return d.id})
@ -38,6 +38,12 @@ d3.json("/static/js/group1.json", function(error, json) {
})
.call(force.drag);
d3.select("body").on("click",function(i){
stop(i.id);
});
node.append("image")
.attr("xlink:href", "/static/images/squig2.png")
.attr("x", -8)
@ -116,21 +122,33 @@ function popup(name,time) {
//stop events when clicking somewhere else
// $(document).click(function (e) {
// if (!$(e.target).parents().andSelf().is('#dadaloglu')) {
// $("#showdadaloglu").fadeOut();
// $("#audiodadaloglu").trigger('pause');
// var textdada = document.getElementById("textdadaloglu");
// textdada.classList.remove("active");
// };
// if (!$(e.target).parents().andSelf().is('#asikA')) {
// $("#showasikA").fadeOut();
// $("#audioasikA").trigger('pause');
// var textmuh = document.getElementById("textasikA");
// textmuh.classList.remove("active");
// };
//
// });
function stop(name) {
$(document).click(function (e) {
if (!$(e.target).parents().andSelf().is('#dadaloglu')) {
$("#showdadaloglu").fadeOut();
$("#audiodadaloglu").trigger('pause');
var textdada = document.getElementById("textdadaloglu");
if (!$(e.target).parents().andSelf().is('#'+ name)) {
$("#show"+name).fadeOut();
$("#audio"+name).trigger('pause');
var textdada = document.getElementById("text"+name);
textdada.classList.remove("active");
};
if (!$(e.target).parents().andSelf().is('#asikA')) {
$("#showasikA").fadeOut();
$("#audioasikA").trigger('pause');
var textmuh = document.getElementById("textasikA");
textmuh.classList.remove("active");
};
});
};
});
//
//
// });