pixelcog/parallax.js

data-position-y not working

Closed this issue · 11 comments

Hi
i am sure i am asking something simple but sorry i am not a coder. My Question is
I have tried data-position-x="' which works perfectly fine. but when i tried data-position-y="" it doesnt work. Any idea how to make it work?

thank you

I'm experiencing the same thing :(

I am also experiencing this problem with position-y

I'm also experiencing this.

phifa commented

can confirm. it does not work. is there a fix available?

phifa commented

I had a look at the code, but I have no idea. Maybe @mikegreiling can have a look?

same problem - the positionX works fine, but I can't get Y to work even tinkering with the js code.

I have a .sticky-header, and I was thinking that was causing the Y value to fail. no success yet.

apparently the author isn't interested.

I'm experiencing the same thing too. I had a Steaky header and think this should be the problem....

I fix it by adding the calculated height of the sticky header to my img in mirror class:

img.parallax-slider {
    margin-top: 215px;
}

something like this

you could do it in JS to calculate the height's values.

I see a culprit:

if (this.positionY != 'top' && this.positionY != 'bottom') { if (isNaN(parseInt(this.positionY))) { this.positionY = 'center'; } else { this.positionY = parseInt(this.positionY); } }

The above code looks as if it calculates the number values from the data fed into parallax configuration. There are no declarations for top or bottom.

The proceeding logic breaks down into ternary operators that assign the position as one line of paresable CSS:

this.position = this.positionX + (isNaN(this.positionX)? '' : 'px') + ' ' + this.positionY + (isNaN(this.positionY)? '' : 'px');

We'll take a stab at it and what looks to be some calculation issues with the base variables.

Great library, btw.

please read @mikegreiling comment in #24 or mine in #191. might be the reason