Layers are following mouse cursor in the top left corner. #39

Open
hunter9 opened this Issue Jun 14, 2012 · 8 comments

6 participants

@hunter9

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

@lsdreamer

Try messing with the x and y parallax options

@adambundy

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

@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.

@Cerealkillerway

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...

@samlyons1985

Thanks @Cerealkillerway that tip really helped me.

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

@allysonsouza

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?

@Cerealkillerway

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 ;)

@allysonsouza

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. : )

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment