Skip to content

Commit

Permalink
Save scroll position and show the bars on OSX
Browse files Browse the repository at this point in the history
  • Loading branch information
guntrip committed May 19, 2017
1 parent 552c8ef commit 8cc1e18
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
13 changes: 12 additions & 1 deletion magic.js
Original file line number Diff line number Diff line change
Expand Up @@ -1075,9 +1075,21 @@ function md2html(md) {

// form modification
function form_redraw(array) {

// Save scroll position:
var scrolled = $('#viewport').scrollLeft();

// Redraw the form!
var html = array2form(array);
$('.preview').html(html);

// Resize cells
form_resize();

// Restore scroll position, we first scroll one pixel to force
// Chrome on OSX to show the scrollbars.
$('#viewport').scrollLeft(1).scrollLeft(scrolled);

}

function form_add_row() {
Expand Down Expand Up @@ -1218,7 +1230,6 @@ function form_resize() {

if ((global_form_cols>5)&&(global_form_cols<13)) {
$('#viewport').css('width', '100%');
console.log('yo')
}

if (global_form_cols>12) {
Expand Down
1 change: 1 addition & 0 deletions styles.css
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,7 @@ button.btn-formmod:hover {

table.form.scroll {
table-layout: fixed;
margin-bottom:7px;
}

table.form.scroll td {
Expand Down

0 comments on commit 8cc1e18

Please sign in to comment.