cameronmcefee / plax

JQuery powered parallaxing
http://www.cameronmcefee.com/plax
MIT License
2.28k stars 206 forks source link

Using plax multiple times on a page #20

Open seanjacob opened 12 years ago

seanjacob commented 12 years ago

So I have set up two zones #one & #two to use plax in. It seems that plax #one has control of both zones.

Here is my setup, am I doing anything wrong?

//PLAX - ONE
$('#one img').plaxify()
$('#one  .back').plaxify({ "xRange": 50, "yRange": 0 })
$('#one .front').plaxify({ "xRange": 30, "yRange": 0, "invert": true })
$.plax.enable({ "activityTarget": $('#one') })

//PLAX - TWO
$('#two img').plaxify()
$('#two .back').plaxify({ "xRange": 50, "yRange": 0, "invert": true })
$('#two .front').plaxify({ "xRange": 30, "yRange": 0 })
$.plax.enable({ "activityTarget": $('#two') })

Cheers Sean.

cameronmcefee commented 12 years ago

Hi @seanjacob,

You're not doing anything wrong per se. Plax simply doesn't support what you want to do at this point. It only supports one activity target and one event stream, so any objects you call plaxify() all get assigned to that single instance. It would be cool to support the notion of encapsulated plax zones, each having it's own set of objects, but that's beyond my knowledge at the moment. I'll ask around and see if I can come up with a solid way to implement it.

seanjacob commented 12 years ago

Cool thanks for clearing that up.

For a work around I've just copied the file and did some renaming so I am calling plax2 on my second zone.

Sam-Hoult commented 11 years ago

This this be implemented?

cameronmcefee commented 11 years ago

Plax is a bit of a back-burner project at the moment, so unfortunately no work has been made on this front yet. I happily accept pull requests though, if you're interested in implementing it.