HANSONGTSENG (Talk | contribs) |
HANSONGTSENG (Talk | contribs) |
||
Line 477: | Line 477: | ||
<script type="text/javascript"> | <script type="text/javascript"> | ||
$(document).ready(function(){ | $(document).ready(function(){ | ||
− | var dots = []; | + | var dots = []; |
var contents = document.getElementsByClassName("subtitle"); | var contents = document.getElementsByClassName("subtitle"); | ||
− | |||
− | |||
− | |||
− | |||
− | |||
for (var i = 0; i <= contents.length - 1; i++) { | for (var i = 0; i <= contents.length - 1; i++) { | ||
− | + | dots.push('<div class="sidebar-item"><span class="sidebar-stuff sidebar-switch dot"></span><div class="sidebar-content sidebar-stuff"><a href=#'+(i+1)+">"+contents[i].innerHTML+'</a></div></div>'); | |
− | + | ||
} | } | ||
− | |||
$("#dot-side-bar").html(dots.join().replace(/,/g,'')); | $("#dot-side-bar").html(dots.join().replace(/,/g,'')); | ||
}); | }); | ||
+ | |||
Line 507: | Line 501: | ||
if(window.pageYOffset <=borders[i+1]) { | if(window.pageYOffset <=borders[i+1]) { | ||
sidebar[i].style.display = "inline-block"; | sidebar[i].style.display = "inline-block"; | ||
+ | } | ||
+ | else{ | ||
+ | sidebar[i].style.display = "none"; | ||
} | } | ||
} | } | ||
else{ | else{ | ||
sidebar[i].style.display = "none"; | sidebar[i].style.display = "none"; | ||
− | |||
} | } | ||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
} | } | ||
}); | }); | ||
+ | |||
+ | $(".sidebar-item").mouseenter(function(){ | ||
+ | this.lastChild.style.display = "inline-block"; | ||
+ | }); | ||
+ | $(".sidebar-item").mouseleave(function(){ | ||
+ | this.lastChild.style.display = "none"; | ||
+ | }); | ||
}); | }); | ||
+ | |||
</script> | </script> |
Revision as of 04:58, 12 July 2018