Centering a parallax image - javascript error

1 reply · opened May 4, 2022

FfotobobMay 4, 2022

If I attempt to center a parallax image by doing something like this:

data-bottom-top="background-position:0px 0px;" data-top-bottom="background-position:center -300px;"

I get this javascript error:
Can't interpolate between "{?}px {?}px" and "center {?}px"

So, how do I center a parallax image without triggering a javascript error, or can I just ignore the error?

P.S. After I wrote the above, I may have stumbled on to the fix:

data-bottom-top="background-position:center 0px;" data-top-bottom="background-position:center -300px;"

with "center" on both instances the javascript error goes away, but the image does not center. Can centering be done?

SSemicolon WebSTAFFMay 5, 2022

Hello,

Consider using the following settings instead:
[ch_pre]data-bottom-top="background-position:50% 0px;" data-top-bottom="background-position:50% -300px;"[/ch_pre]

This should definitely work fine. Hope this Helps!

Let us know if we can help you with anything else or if you find any further issues.

Have the same question, or something new?

Sign in to the Canvas dashboard to reply or open your own topic. Canvas owners get direct help from the SemiColonWeb team.

Reply on the dashboard