Difference between revisions of "Template:SJTU-BioX-Shanghai/Alpha/Header"

Line 13: Line 13:
 
   for (var i = 0; i < headings.length; i++) {
 
   for (var i = 0; i < headings.length; i++) {
 
     var h = headings[i];
 
     var h = headings[i];
     var top = h.offsetTop;
+
     var top = $(h).offset().top;
     if (top >= TOP) break
+
     if (top > TOP ) break
 
   }
 
   }
 +
  if (i > 0) h = headings[i-1]
 
   //set h as reading part
 
   //set h as reading part
 
   var id = h.id;
 
   var id = h.id;
  console.log('current', id);
 
  
 
   var prev_a = $('#toc a.reading');
 
   var prev_a = $('#toc a.reading');

Revision as of 09:19, 17 August 2015