MediaWiki:Common.js: Difference between revisions

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


// handle click event
$table.on("click", "div.tt div.content", function (e) {
var $el = $(e.currentTarget).closest(".tt");
var $el = $(e.currentTarget).closest(".tt");
var $tr = $el.closest("tr");
var $tr = $el.closest("tr");
Line 169: Line 169:
$("." + $el.attr("data-tt-id")).fadeIn(400, function(){updateLines()});
$("." + $el.attr("data-tt-id")).fadeIn(400, function(){updateLines()});
}
}
updateLines();
});
$( window ).resize(function() {
updateLines();
updateLines();
});
});
Confirmedusers, editor, Administrators
886

edits