plax icon indicating copy to clipboard operation
plax copied to clipboard

enable/disable plax few times ipad/iphone stop working

Open senerdude opened this issue 12 years ago • 3 comments

I have 6 diffrent div, every div has 4 png. this divs in a slider. when slider init I'm enabling plax on number 1 div. when I slide to another div disable number 1 div and activate second div's plax. its working fine. but in ipad or iphone after few times disable/enable parallax stop working.

here is sample two function when change slide. Am I doing wrong?

thank you

function initSlideOne() { $.plax.disable({ "clearLayers": true, "restorePositions": true }); $("#SlideOne img.layer1").plaxify({ "xRange": 0 }); $("#SlideOne img.layer2").plaxify({ "xRange": 100 }); $("#SlideOne img.layer3").plaxify({ "xRange": 130 }); $("#SlideOne img.layer4").plaxify({ "xRange": 100, "invert": true }); $("#SlideOne img.layer5").plaxify({ "xRange": 200, "invert": true }); $.plax.enable({ "activityTarget": $('#SlideOne') }); }

function initSlideTwo() { $.plax.disable({ "clearLayers": true, "restorePositions": true }); $("#SlideTwo img.layer1").plaxify({ "xRange": 0 }); $("#SlideTwo img.layer2").plaxify({ "xRange": 100 }); $("#SlideTwo img.layer3").plaxify({ "xRange": 130 }); $("#SlideTwoe img.layer4").plaxify({ "xRange": 100, "invert": true }); $("#SlideTwo img.layer5").plaxify({ "xRange": 200, "invert": true }); $.plax.enable({ "activityTarget": $('#SlideTwo') }); }

senerdude avatar Nov 26 '13 21:11 senerdude

Not able to reproduce on iPhone, iOS 7.0.4... I've tried enabling/disabling about 20 times without it stopping to work... How frequent does this happen on your end? Every second time? Every 50th time?

Two differences in how I use it compared to the sample you give;

  • I do not use a activityTarget for enable.
  • Each img element has data-xrange, data-yrange, and data-invert attributes and a specific class for "tagging". Then I simply do $('.PlaxLayer', '#SlideOne').plaxify() to apply to all elements at the same time, instead of calling .plaxify once for each element.

Otherwise I use it pretty much identical to your approach.

magebarf avatar Nov 27 '13 01:11 magebarf

you can test from : http://pureservice.me/PlaxTest.html

I noticed (iphone5-ios7) plax working first load and rotation. I just touched screen and it stops working. tryed again continue to work.. after I clicked emty links on the page (it return false) stop worked again. something intturped code but I'm not sure what it is.

I'm optimizing my codes, I will send you when I finis it.. you can see oter screens.

thank you

senerdude avatar Nov 27 '13 10:11 senerdude

its only stop in IOS. in android we tryed everyting still continue to work.

senerdude avatar Nov 27 '13 11:11 senerdude