You are not logged in.

Dear visitor, welcome to krpano.com Forum. If this is your first visit here, please read the Help. It explains in detail how this page works. To use all features of this page, you should consider registering. Please use the registration form, to register here or read more information about the registration process. If you are already registered, please login here.

1

Monday, November 14th 2011, 3:14pm

Width/Height as a Percentage While Maintaining Aspect Ratio

Hi, I was wondering if it were possible to set the width of a plugin as a percentage, and have it resize while maintaining its aspect ratio.

To put this into context, I have a "Gallery" button I wish to display within a tour, and I want it to be 20% of the screen width for any user. The problem that I have with this is that if I set the width to a percentage, the height remains constant and it stretches and distorts with the browser.

Is there any way to set the XML so that the width will remain a constant 20%, and the height scale according to the width? Currently the only way I can see of doing this is with an onresize event, but that seems incredibly long-winded and messy.

Any help will be appreciated.

Posts: 1,850

Occupation: Virtual Tours - Photography - Krpano developer

  • Send private message

2

Monday, November 14th 2011, 3:30pm

Set one to percent, set the other one to "PROP"
KRPano Developer: Portfolio ::Gigapixel Tagging Solutions - Porfolio 2 :: Facebook :: Twitter :: reddit.com/r/VirtualTour

3

Monday, November 14th 2011, 3:32pm

Set one to percent, set the other one to "PROP"
Works perfectly! Thanks so much.