Weppa333
Well-known member
Hi
I'm trying to custimize xenforo.js ; because I think the responsive way to hide the navbar is wrong : the navtabs (dark blue on this site) are hidden in a way that makes sense ( the one at the left is always visible) but the navlinks ( light blue here) are hidden the other way ( the one at the right is kept last )
This is handled by
I tried reversing $linkslist, which helps, but the entire logic to HIDE the links (bottom of the script) has to be rewritten I think...
Or maybe there's a simpler way that is simply out of my understanding
can anyone help ?
I'm trying to custimize xenforo.js ; because I think the responsive way to hide the navbar is wrong : the navtabs (dark blue on this site) are hidden in a way that makes sense ( the one at the left is always visible) but the navlinks ( light blue here) are hidden the other way ( the one at the right is kept last )
This is handled by
Code:
updateVisibleNavigationLinks: function()
{
var $linksList = $('#navigation').find('.navTab.selected .blockLinksList');
if (!$linksList.length)
{
return;
}
var $links = $linksList.find('> li'),
listOffset = $linksList.offset(),
$hidden = $links.filter('.navigationHidden'),
$firstHidden = false;
$links.show();
$hidden.hide();
if ($linksList.is('.showAll'))
{
return;
}
var hiddenForMenu = [],
$lastLink = $links.filter(':not(.navigationHidden)').last(),
hideOffset = 0,
hasHidden = false,
lastCoords,
$link;
if (!$lastLink.length)
{
return;
}
do
{
lastCoords = $lastLink.coords();
if (lastCoords.top > listOffset.top + lastCoords.height)
{
$link = $links.eq(hideOffset);
$link.hide();
hiddenForMenu.push($link);
hideOffset++;
if (!hasHidden)
{
hasHidden = true;
if (!$hidden.length)
{
$hidden = $('<li class="navigationHidden Popup PopupControl PopupClosed"><a rel="Menu" class="NoPopupGadget">...</a><div class="Menu blockLinksList primaryContent" id="NavigationLinksHiddenMenu"></div></li>');
$linksList.append($hidden);
new XenForo.PopupMenu($hidden);
}
else
{
$hidden.show();
}
}
}
else
{
break;
}
}
while (hideOffset < $links.length);
if (hasHidden)
{
if (hideOffset < $links.length)
{
var coords = $hidden.coords();
if (coords.top > listOffset.top + coords.height)
{
$link = $links.eq(hideOffset);
$link.hide();
hiddenForMenu.push($link);
}
}
var $hiddenList = $('<ul />');
$(hiddenForMenu).each(function() {
$hiddenList.append(
$('<li />').html($(this).find('a').clone())
);
});
$('#NavigationLinksHiddenMenu').html($hiddenList).xfActivate();
}
},
I tried reversing $linkslist, which helps, but the entire logic to HIDE the links (bottom of the script) has to be rewritten I think...
Or maybe there's a simpler way that is simply out of my understanding
can anyone help ?