jparallax icon indicating copy to clipboard operation
jparallax copied to clipboard

Layers are following mouse cursor in the top left corner.

Open hunter9 opened this issue 12 years ago • 8 comments

Hello,

I'm not sure what I'm doing wrong but the layers on my page follow the mouse cursor in the top left corner instead of pushing them around smoothly. I used your target example as a guide and it works great locally, but once on the server, it acts funky. I should note that every once in a while after refreshing a few times the pictures will actually line up as they should, but most of the time (especially if cache is cleared) they don't line up. I also tried it on two different computers in Opera, Chrome, and Firefox with the same results. I haven't had too much experience with jQuery so I hope this isn't a silly question. I would really appreciate any help.
Thank you very much.

-Jeff

Anyway, I put together an example of the problem: http://art616.com/demos/44.html

...and here is my code (since it doesn't work pasting it in here): http://art616.com/demos/44.txt

hunter9 avatar Jun 14 '12 05:06 hunter9

Try messing with the x and y parallax options

lsdreamer avatar Jul 15 '12 20:07 lsdreamer

Im having this same issue, oddly in Chrome only. @hunter9 did you get this sorted?

adambundy avatar Jul 25 '12 16:07 adambundy

I got my case figured out. It is an image that I'm sliding around, and it needed physical width and height attributes to work properly.

adambundy avatar Jul 25 '12 18:07 adambundy

Hello, i was having the same problem (layers sometimes were following the mouse pointer from top left corner, sometimes were working fine). I found that the problem was due to incomplete DOM loading before pallax initialization... Here's the solution:

Normally, like in the demo, i was calling parallax after the html images like this:

All you need is to call this function not on jQuery(document).readyfunction, but after a specified timeout (for example 500 ms) like this:

And everything works...

I hope it helps...

Cerealkillerway avatar Jan 02 '13 11:01 Cerealkillerway

Thanks @Cerealkillerway that tip really helped me.

Here is a my demo of it working http://codepen.io/samlyons1985/pen/jrgyc

samlyons1985 avatar Jan 24 '13 03:01 samlyons1985

I'm having the same problem. Head.js solves the problem, but, I will use the parallax into a Wordpress website. Use setTimeout don't works for me, and I think it's a fragile workaround. Someone have a suggestion to prevent the parallax init before the DOM load?

allysonsouza avatar May 01 '13 20:05 allysonsouza

Now i'm using parallax wrapping it inside

jQuery(window).load(function () { }

instead of

jQuery(document).ready(function () { }

This works well; obviously, parallax will not start until the page is fully loaded, but this is not a problem for me ;)

Cerealkillerway avatar May 02 '13 08:05 Cerealkillerway

Thanks Cerealkillerway, it's the perfect solution. I don't know why, but here the parallax only works if the page has been fully loaded. : )

allysonsouza avatar May 02 '13 14:05 allysonsouza