Scripta UI Integration Notes

scripta-layout

Scrolling

The scroll position is saved in a JavaScript variable savedScrollState in Demo/index.html:

 var savedScrollState = null;                                                                                                                                                                                                                                         
                                                                                                                                                                                                                                                                      
 // When scrollToElement is called:                                                                                                                                                                                                                                   
 savedScrollState = {                                                                                                                                                                                                                                                 
     scrollTop: renderedOutput.scrollTop,  // scroll position of rendered-output div                                                                                                                                                                                  
     elementId: elementId                   // id of highlighted element                                                                                                                                                                                              
 };                                                                                                                                                                                                                                                                   

It captures scrollTop from the rendered-output div (the right panel where equations are displayed) before scrolling to the target element. On ESC, it restores that position and clears the saved state