Difference between revisions of "Template:NYMU-Taipei/newtemplate1"

Line 499: Line 499:
 
var items = document.getElementsByClassName("sidebar-item");
 
var items = document.getElementsByClassName("sidebar-item");
 
     $(window).scroll(function(){
 
     $(window).scroll(function(){
     var borders = [];
+
     var borders = [0];
 
     for (var i = 0; i <= subtitles.length - 1; i++) {
 
     for (var i = 0; i <= subtitles.length - 1; i++) {
 
     borders.push(subtitles[i].scrollHeight+borders[i]-100);
 
     borders.push(subtitles[i].scrollHeight+borders[i]-100);
 
     }
 
     }
console.log(borders);
 
 
         for (var i = 0; i < subtitles.length; i++) {
 
         for (var i = 0; i < subtitles.length; i++) {
         if ((window.pageYOffset >=borders[i])(window.pageYOffset <=borders[i+1])) {
+
         if (window.pageYOffset >=borders[i]){
 +
        if(window.pageYOffset <=borders[i+1]) {
 
         sidebar[i].style.display = "inline-block";
 
         sidebar[i].style.display = "inline-block";
 +
        }
 
         }
 
         }
 
         else{
 
         else{

Revision as of 04:51, 12 July 2018