Browse Source

tryout to automate stop events on popups

master
nglk 4 years ago
parent
commit
f5ef7ef386
  1. 46
      static/js/d3_map.js

46
static/js/d3_map.js

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

Loading…
Cancel
Save