colelawrence / Touch-Splitter-jQuery

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

Split position on start #8

Closed pju- closed 8 years ago

pju- commented 8 years ago

Hello, great work on this splitter, really easy and performative!

Is there an easy way to set up this splitter so that the bar doesn't start in the middle, but (e.g.) at 66% width or height?

Thanks!

colelawrence commented 8 years ago

Sorry, I accidentally hit Close and comment when replying.

pju- commented 8 years ago

Wow man, thanks for the quick reply. Actually, I just now did my own rewrite with an added option "startPosition". Seems to work just fine. Do you want me to send you a PR?

colelawrence commented 8 years ago

Yes, so if you do:

var splitter = $('#main-splitter').touchSplitter(options)
splitter.barPosition = .66 // 66%
splitter.setPercentages() // recalculates positions and percentages

You should be in the clear ;-)

colelawrence commented 8 years ago

@pju- yeah if you added an option to the coffee source and rerun the cakefile, I'll check it out and merge it :+1:

pju- commented 8 years ago

Perfect, I've sent you the PR now. Thanks for the super quick reply and help!