Skip to content
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

Split panes not resized correctly when window size changes #29

Closed
joakimgunst opened this issue Dec 14, 2015 · 10 comments
Closed

Split panes not resized correctly when window size changes #29

joakimgunst opened this issue Dec 14, 2015 · 10 comments

Comments

@joakimgunst
Copy link

  1. Open http://nathancahill.github.io/Split.js/ in Chrome
  2. Resize the browser window to about 800 pixels in width
  3. Reload the page
  4. Increase the width of the browser window

This causes empty white space to the right of the second split pane, which at least in my case is incorrect. The desired behavior would be to have the panes to increase in size to fill the container.

@PAEz
Copy link

PAEz commented Jan 8, 2016

When this error occurs its because the initial width for the column is not using calc(percent)-woteva but is setting the width to a hard value like 216px.
This is happening in balancePairs when it calls the fit functions.
These are only called if min or max are set.
Gotta make those functions set the width to a percentage.

@PAEz
Copy link

PAEz commented Jan 8, 2016

The simplest solution (that seems to work, I dont know this code well enough to say for sure) is to put this....

for (i = pairs.length - 1; i >= 0; i--) {
                adjust.call(pairs[i],pairs[i].a[getBoundingClientRect]()[dimension])
            }

at the end of balancePairs.
You can see this working....
http://plnkr.co/edit/ndQdCPAiZ7t6lDA32m4i?p=preview
...yeah I know, shoulda PR, lazy, lazy, lazy

@pedrogit
Copy link

pedrogit commented Jan 8, 2016

I had the same issue. PAEz's addition seems to fix it...

@nathancahill
Copy link
Owner

Ah, great @PAEz! I'll test this and get it merged in.

@jdanyow
Copy link

jdanyow commented Jan 13, 2016

@PAEz's fix works for me too, except when there are three horizontal panes. @PAEz's fix seems to help with the zoom issue too. 👍

@PAEz
Copy link

PAEz commented Jan 14, 2016

@jdanyow any chance you could fork my plunker (you dont need to sign up or anything) and make an example of it failing? I was going to have another look at this in a few days.

@zhy1stgg
Copy link

nice work..:thumbsup:

@narinearraul
Copy link

Hi all, just got this problem with my project. Has this fix been pushed to the lib yet?

@Wyzix33
Copy link

Wyzix33 commented Dec 22, 2016

Problem not solved yet ...

@nathancahill
Copy link
Owner

Fixed in v1.2.0 by switching the balancePairs functionality to adjusting the minSize instead.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

8 participants