Skip to content

fix: Fix the split in HTML at 33/67% instead of calculating percentages #939

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Oct 12, 2017
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 1 addition & 10 deletions src/default_theme/assets/site.js
Original file line number Diff line number Diff line change
Expand Up @@ -113,15 +113,6 @@ split_left.style.overflow = 'hidden';
var cw_without_sb = split_left.clientWidth;
split_left.style.overflow = '';

// Need to add:
// - Half of gutterSize (i.e. 10) because gutter will take that much from each.
// - Scrollbar width (cw_with_sb - cw_without_sb), if it takes up existing
// space (Firefox) rather than adding the scrollbar to the side (Chrome)
var percent_left =
(split_left.getBoundingClientRect().width + 10 + cw_without_sb - cw_with_sb) /
split_parent.getBoundingClientRect().width *
100;

Split(['#split-left', '#split-right'], {
elementStyle: function(dimension, size, gutterSize) {
return {
Expand All @@ -134,7 +125,7 @@ Split(['#split-left', '#split-right'], {
};
},
gutterSize: 20,
sizes: [percent_left, 100 - percent_left]
sizes: [33, 67]
});

// Chrome doesn't remember scroll position properly so do it ourselves.
Expand Down