colelawrence / Touch-Splitter-jQuery

A high performance html splitter compatible with touch events
14 stars 7 forks source link

Set default size of left and right panels #12

Open d2phap opened 7 years ago

d2phap commented 7 years ago

Thanks for your useful lib.

Whenever I load my webpage, the left and right panel's size ratio is 50-50%. I checked the source code, there are somethings like leftMin, leftMax, rightMin,... but no option for default width.

So how can I set default size of left and right panels ?

colelawrence commented 7 years ago

Use the "thickness" option see the demo code:

https://github.com/ZombieHippie/Touch-Splitter-jQuery/blob/gh-pages/index.html#L47

On Fri, 7 Oct 2016, 9:57 AM Phap, Duong Dieu notifications@github.com wrote:

Thanks for your useful lib.

Whenever I load my webpage, the left and right panel's size ratio is 50-50%. I checked the source code, there are somethings like leftMin, leftMax, rightMin,... but no option for default width.

So how can I set default size of left and right panels ?

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/ZombieHippie/Touch-Splitter-jQuery/issues/12, or mute the thread https://github.com/notifications/unsubscribe-auth/ACyjUzUY5nNbL0_t3VPd4dBxD94MGtkXks5qxl3cgaJpZM4KRH4U .

d2phap commented 7 years ago

The "thickness" is just to increase the thickness of splitter. I want, by default, I can change the width ratio of left and right panel.

For ex:

image

colelawrence commented 7 years ago

@d2phap if you create the touchsplitter and then set the property splitter.barPosition = .2 (any number between 0 and 1), that ratio will be used. Then you just need to use splitter.moveBar() to update the element.