nk-o / jarallax

Parallax scrolling for modern browsers
https://jarallax.nkdev.info
MIT License
1.39k stars 214 forks source link

Image horizontal background position ignored #215

Closed hidegh closed 1 year ago

hidegh commented 1 year ago

Issue description:

See #141 - setting the horizontal position works, but the vertical is always sticking to the bottom.

Since the data attribute allows both values to be set and then the library is then repositioning the image always to bottom, I'd say it's probably a bug.

NOTE: based on the original position, screen's height, parallax speed we'd ev. know how much reserve we'd need and thus the vertical alignment could be more flexible.

Version used:

2.0.4

Code to reproduce the issue (HTML blocks + JavaScript initialization)

          <div class="h-100 w-100 jarallax" data-jarallax data-type="scale" data-speed="-1" data-img-position="0% 50%">
            <img class="jarallax-img" src="/assets/bg/team/pexels-fauxels-3184355.jpg">
          </div>
nk-o commented 1 year ago

Most probably your image already has a full height covered and there is no space to move its position. Try to add Portrait photos - the vertical position will work, but the horizontal - not.