toymakerlabs / kenburns

A Jquery gallery featuring CSS3 hardware accelerated pan-and-zoom, Ken Burns style transitions.
161 stars 65 forks source link

Forced Directions #23

Open YetiFace opened 8 years ago

YetiFace commented 8 years ago

I want to start off by saying this is my first time suggesting a file edit to a repository I'm not involved in, and that I'm relatively new to programming as an occupation, so please do let me know if you think I've done anything in a 'newbie' way. I'm very happy to be corrected and learn.

Thank you so much for writing this Javascript library, it's been really great. However if you want the slide show to cover a client's whole screen, a problem can crop up with parts of the photo disproportionately outside of its border. A laptop screen for example can wind up expanding the photo to fit the width, and then having a chunk of the picture outside the border vertically. This means when your kenburns.js gets to work the vertical movements will be much faster than the horizontal movements.

The fix I've gone for is adding the option to force movements to be either wholly vertical or horizontal. If you want to use that option you just set the forceDirection variable to either 'horizontal' or 'vertical' when initialising the Plugin on an element.