MediaWiki:Common.js: Difference between revisions

From Vintage Story Wiki
no edit summary
No edit summary
No edit summary
Line 112: Line 112:
// handle click event
// handle click event
$table.on("click", "div.tt div.content", function (e) {
$table.on("click", "div.tt div.content", function (e) {
function updateLines()
{
//Update height of all items
items.forEach(function (item) {
if (item.parent === undefined) {
return;
}
var childPos = item.el.position();
var parent = item.parent;
var parentPos = parent.el.position();
var height = childPos.top - parentPos.top;
item.el.find(".tail").css("height", height);
});
}


var $el = $(e.currentTarget).closest(".tt");
var $el = $(e.currentTarget).closest(".tt");
Line 135: Line 154:


hide(id);*/
hide(id);*/
$("." + $el.attr("data-tt-id")).hide();
$("." + $el.attr("data-tt-id")).fadeOut(400, updateLines());
}
}
else {
else {
Line 143: Line 162:
$(child.el).closest("tr").removeClass("tt-hide");
$(child.el).closest("tr").removeClass("tt-hide");
});*/
});*/
$("." + $el.attr("data-tt-id")).show();
$("." + $el.attr("data-tt-id")).fadeIn(400, updateLines());
}
}
//Update height of all items
items.forEach(function (item) {
if (item.parent === undefined) {
return;
}
var childPos = item.el.position();
var parent = item.parent;
var parentPos = parent.el.position();
var height = childPos.top - parentPos.top;
item.el.find(".tail").css("height", height);
});
});
});


Confirmedusers, editor, Administrators
886

edits