Showing 1 changed files with 10 additions and 2 deletions
+10 -2
templates/index.html.ep
... ...
@@ -16,8 +16,6 @@
16 16
     var current_word_count_h;
17 17
     var current_pos;
18 18
     
19
-    var fragment = location.hash;
20
-    
21 19
     $("#word-pos").text('-');
22 20
     
23 21
     $("#up-arrow").on('click', function () {
... ...
@@ -37,6 +35,7 @@
37 35
           }
38 36
         } else {
39 37
           location.href = '#word-' + prev_pos;
38
+          scroll_little_up ();
40 39
           current_pos--;
41 40
           $('#word-pos').text(prev_pos);
42 41
         }
... ...
@@ -61,6 +60,7 @@
61 60
         }
62 61
         else {
63 62
           location.href = '#word-' + next_pos;
63
+          scroll_little_up();
64 64
           current_pos++;
65 65
           $('#word-pos').text(next_pos);
66 66
         }
... ...
@@ -94,6 +94,7 @@
94 94
             current_pos = 1;
95 95
           }
96 96
           location.href = '#word-' + current_pos;
97
+          scroll_little_up ();
97 98
           $('#word-pos').text(current_pos);
98 99
         }
99 100
         current_book_id = book_id;
... ...
@@ -154,6 +155,13 @@
154 155
         $('#search').trigger('click');
155 156
       }
156 157
     });
158
+    
159
+    // 少し上へスクロール
160
+    function scroll_little_up () {
161
+      var current_scroll_top = $('#content').scrollTop();
162
+      $('#content').scrollTop(current_scroll_top - 130);
163
+      //$('#content').animate({ scrollTop: current_scroll_top - 50 }, 'fast')
164
+    }
157 165
   });
158 166
 % end
159 167