Commit 4961471f authored by Jonny Bradley's avatar Jonny Bradley

[FIX] comments: When comments are on a separate tab (e.g. tracker items) then...

[FIX] comments: When comments are on a separate tab (e.g. tracker items) then switch tab before scrolling and highlighting the comment linked to in the url (by threadId)
parent 14024622
......@@ -1783,6 +1783,17 @@ $.fn.tiki = function(func, type, options) {
var match = location.hash.match(/threadId=?(\d+)/);
if (match) {
var $tab = $(this).parents(".tab-pane"),
$tabContent = $(this).parents(".tab-content");
// if we're in an inactive tab then show the right one for this comment threadId
if ($tab.length && ! $tab.is(".active")) {
$tabContent.find(".tab-pane").each(function (index) {
if (this === $tab[0]) {
$(".nav-tabs li:nth(" + index + ") a", $tabContent.parent()).tab("show");
}
})
}
var $comment = $(".comment[data-comment-thread-id=" + match[1] + "]");
var top = $comment.offset().top + $comment.height() - ($window.height() / 2);
$('html, body').animate({
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment