##// END OF EJS Templates
Improving the scrolling model.
Brian E. Granger -
Show More
@@ -61,7 +61,7 b' input, select { vertical-align: middle; }'
61 61 body {
62 62 background-color: white;
63 63 /* This won't propagate to all children so we also set it below */
64 font-size: 12pt;
64 font-size: 10pt;
65 65 /* This makes sure that the body covers the entire window and needs to
66 66 be in a different element than the display: box in wrapper below */
67 67 position: absolute;
@@ -82,10 +82,6 b' span#ipython_notebook h1 {'
82 82
83 83 }
84 84
85 div#tools {
86 font-size: 11pt;
87 }
88
89 85 span#kernel_status {
90 86 position: absolute;
91 87 top: 12%;
@@ -138,10 +134,10 b' div#notebook {'
138 134 overflow-y: scroll;
139 135 overflow-x: auto;
140 136 width: 100%;
141 padding: 0px 15px 15px 15px;
137 padding: 0px 15px 0px 15px;
142 138 margin: 0px
143 139 background-color: white;
144 font-size: 12pt;
140 font-size: 10pt;
145 141 }
146 142
147 143 div#pager_splitter {
@@ -149,12 +145,13 b' div#pager_splitter {'
149 145 }
150 146
151 147 div#pager {
148 padding: 15px;
152 149 overflow: auto;
153 150 }
154 151
155 152 .monospace-font {
156 153 font-family: monospace;
157 font-size: 12pt;
154 font-size: 10pt;
158 155 }
159 156
160 157 div.cell {
@@ -194,7 +191,7 b' div.output_area {'
194 191
195 192 div.output_latex {
196 193 /* Slightly bigger than the rest of the notebook */
197 font-size: 13pt;
194 font-size: 11pt;
198 195 }
199 196
200 197 div.output_png {
@@ -206,7 +203,7 b' div.text_cell {'
206 203
207 204 textarea.text_cell_input {
208 205 /* Slightly bigger than the rest of the notebook */
209 font-size: 13pt;
206 font-size: 11pt;
210 207 outline: none;
211 208 resize: none;
212 209 width: inherit;
@@ -219,7 +216,7 b' textarea.text_cell_input {'
219 216 div.text_cell_render {
220 217 font-family: "Helvetica Neue", Arial, Helvetica, Geneva, sans-serif;
221 218 /* Slightly bigger than the rest of the notebook */
222 font-size: 13pt;
219 font-size: 11pt;
223 220 outline: none;
224 221 resize: none;
225 222 width: inherit;
@@ -19,6 +19,7 b' var IPython = (function (IPython) {'
19 19 this.notebook_save_re = /%notebook save/
20 20 this.notebook_filename_re = /(\w)+.ipynb/
21 21 this.style();
22 this.create_elements();
22 23 this.bind_events();
23 24 this.start_kernel();
24 25 };
@@ -29,6 +30,16 b' var IPython = (function (IPython) {'
29 30 };
30 31
31 32
33 Notebook.prototype.create_elements = function () {
34 // We add this end_space div to the end of the notebook div to:
35 // i) provide a margin between the last cell and the end of the notebook
36 // ii) to prevent the div from scrolling up when the last cell is being
37 // edited, but is too low on the page, which browsers will do automatically.
38 this.element.append($('<div class="end_space"></div>').height(50));
39 $('div#notebook').addClass('border-box-sizing');
40 };
41
42
32 43 Notebook.prototype.bind_events = function () {
33 44 var that = this;
34 45 $(document).keydown(function (event) {
@@ -77,6 +88,8 b' var IPython = (function (IPython) {'
77 88 }
78 89 if (cell_index === (that.ncells()-1)) {
79 90 that.insert_code_cell_after();
91 // If we are adding a new cell at the end, scroll down to show it.
92 that.scroll_to_bottom();
80 93 } else {
81 94 that.select(cell_index+1);
82 95 };
@@ -114,6 +127,10 b' var IPython = (function (IPython) {'
114 127 };
115 128
116 129
130 Notebook.prototype.scroll_to_bottom = function () {
131 this.element.animate({scrollTop:this.element.get(0).scrollHeight}, 'slow');
132 };
133
117 134 // Cell indexing, retrieval, etc.
118 135
119 136
@@ -158,6 +175,9 b' var IPython = (function (IPython) {'
158 175 this.selected_cell().unselect();
159 176 };
160 177 this.cells()[index].select();
178 if (index === (this.ncells()-1)) {
179 this.scroll_to_bottom();
180 };
161 181 };
162 182 return this;
163 183 };
@@ -228,7 +248,7 b' var IPython = (function (IPython) {'
228 248
229 249
230 250 Notebook.prototype.append_cell = function (cell) {
231 this.element.append(cell.element);
251 this.element.find('div.end_space').before(cell.element);
232 252 return this;
233 253 };
234 254
General Comments 0
You need to be logged in to leave comments. Login now