##// END OF EJS Templates
Add scroll_to_cell(cell_number) to the notebook
Matthias BUSSONNIER -
Show More
@@ -304,6 +304,16 b' var IPython = (function (IPython) {'
304 });
304 });
305 };
305 };
306
306
307 Notebook.prototype.scroll_to_cell = function (cell_number, time) {
308 var cells = this.get_cells();
309 var time = time || 0;
310 cell_number = Math.min(cells.length-1,cell_number);
311 cell_number = Math.max(0 ,cell_number);
312 scroll_value = cells[cell_number].element.position().top-cells[0].element.position().top ;
313 this.element.animate({scrollTop:scroll_value}, time);
314 return scroll_value;
315 };
316
307
317
308 Notebook.prototype.scroll_to_bottom = function () {
318 Notebook.prototype.scroll_to_bottom = function () {
309 this.element.animate({scrollTop:this.element.get(0).scrollHeight}, 0);
319 this.element.animate({scrollTop:this.element.get(0).scrollHeight}, 0);
General Comments 0
You need to be logged in to leave comments. Login now