Wweeiiyyiinn (Talk | contribs) |
Wweeiiyyiinn (Talk | contribs) |
||
Line 13: | Line 13: | ||
for (var i = 0; i < titles.length; i++) { | for (var i = 0; i < titles.length; i++) { | ||
title = titles[i]; | title = titles[i]; | ||
− | title.id = 'passageTitle'+count; | + | title.id = 'passageTitle' + count; |
count += 1; | count += 1; | ||
createSidenavElement(title); | createSidenavElement(title); | ||
} | } | ||
+ | $(window).load(adjustSidenavHeight); | ||
+ | $(window).resize(adjustSidenavHeight); | ||
} | } | ||
} | } | ||
Line 33: | Line 35: | ||
function adjustSidenavHeight() { | function adjustSidenavHeight() { | ||
$("#sidenav-wrapper").removeClass("scroll").removeClass("narrower").removeClass("narrow"); | $("#sidenav-wrapper").removeClass("scroll").removeClass("narrower").removeClass("narrow"); | ||
− | + | narrowSidebar(); | |
} | } | ||
− | function narrowSidebar(){ | + | function narrowSidebar() { |
var lastHeight = $("#sidenav-wrapper").height(); | var lastHeight = $("#sidenav-wrapper").height(); | ||
if ($("#sidenav-wrapper").height() >= $("#mySidenav").height() * 0.9) { | if ($("#sidenav-wrapper").height() >= $("#mySidenav").height() * 0.9) { | ||
narrowerSidebar() | narrowerSidebar() | ||
} | } | ||
− | setTimeout(function(){ | + | setTimeout(function () { |
− | + | if ($("#sidenav-wrapper").height() != lastHeight) { | |
− | if ($("#sidenav-wrapper").height() != lastHeight){ | + | |
narrowSidebar() | narrowSidebar() | ||
− | }else{ | + | } else { |
setTimeout(this, 500) | setTimeout(this, 500) | ||
} | } | ||
Line 52: | Line 53: | ||
function narrowerSidebar() { | function narrowerSidebar() { | ||
− | |||
if (!$("#sidenav-wrapper").hasClass("narrow")) { | if (!$("#sidenav-wrapper").hasClass("narrow")) { | ||
$("#sidenav-wrapper").addClass("narrow"); | $("#sidenav-wrapper").addClass("narrow"); | ||
Line 63: | Line 63: | ||
$(document).ready(createSidenav); | $(document).ready(createSidenav); | ||
− | + | ||
− | + | ||
</script></html> | </script></html> |
Latest revision as of 17:58, 30 October 2017