You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Ok, here is a demo of swipe support... it's a bit of code, but all you need to do is include it inside of a document ready event with the correct target - check out the demo:
jQuery(function($){$('#slider').movingBoxes({startPanel: 4,wrap: true,buildNav: true,navFormatter: function(index,panel){return"●";}});/* Add Swipe to Moving Boxes */vartarget=$('#slider'),// allow movement if < 1000 ms (1 sec)maxTime=1000,// swipe movement of 50 pixels triggers the swipemaxDistance=50,api=target.data('movingBoxes'),startX=0,startTime=0,touch="ontouchend"indocument,startEvent=(touch) ? 'touchstart' : 'mousedown',moveEvent=(touch) ? 'touchmove' : 'mousemove',endEvent=(touch) ? 'touchend' : 'mouseup';api.$wrap.on(startEvent,function(e){// prevent image drag (Firefox)e.preventDefault();startTime=e.timeStamp;startX=e.originalEvent.touches ? e.originalEvent.touches[0].pageX : e.pageX;}).on(endEvent,function(e){startTime=0;startX=0;}).on(moveEvent,function(e){e.preventDefault();varcurrentX=e.originalEvent.touches ? e.originalEvent.touches[0].pageX : e.pageX,currentDistance=(startX===0) ? 0 : Math.abs(currentX-startX),// allow if movement < 1 seccurrentTime=e.timeStamp;if(startTime!==0&¤tTime-startTime<maxTime&¤tDistance>maxDistance){if(currentX<startX){// swipe left code hereapi.goForward();}if(currentX>startX){// swipe right code hereapi.goBack();}startTime=0;startX=0;}});
});
If you are using an older version of jQuery (before v1.7), then replace the on functions with bind.
functionfnIsAppleMobile(){if(navigator&&navigator.userAgent&&navigator.userAgent!=null){varstrUserAgent=navigator.userAgent.toLowerCase();vararrMatches=strUserAgent.match(/(iphone|ipod|ipad|android)/);if(arrMatches)returntrue;}// End if (navigator && navigator.userAgent) returnfalse;}jQuery(function($){$('#slider').movingBoxes({startPanel: 4,reducedSize: 0.9,initAnimation: true,hashTags: false,wrap: true,buildNav: true,speed: 500,stopAnimation: true,fixedHeight: true,easing: 'easeOutBack',navFormatter: function(index,panel){return"●";}preinit: function(e,mb,tar){if(fnIsAppleMobile()==false){varthrottled=false,throttledDelay=200;mb.$window.mousewheel(function(event,delta){if(!throttled){mb.change(mb.curPanel+(delta<0 ? 1: -1));throttled=true;setTimeout(function(){throttled=false;},throttledDelay);}returnfalse;});}}});if(fnIsAppleMobile()==true){/* Add Swipe to Moving Boxes only when the user Agent is an Smartphone */vartarget=$('#slider'),// allow movement if < 1000 ms (1 sec)maxTime=1000,// swipe movement of 50 pixels triggers the swipemaxDistance=50,api=target.data('movingBoxes'),startX=0,startTime=0,touch="ontouchend"indocument,startEvent=(touch) ? 'touchstart': 'mousedown',moveEvent=(touch) ? 'touchmove': 'mousemove',endEvent=(touch) ? 'touchend': 'mouseup';api.$panels.on(startEvent,function(e){// prevent image drag (Firefox)e.preventDefault();startTime=e.timeStamp;startX=e.originalEvent.touches ? e.originalEvent.touches[0].pageX: e.pageX;}).on(endEvent,function(e){startTime=0;startX=0;}).on(moveEvent,function(e){e.preventDefault();varcurrentX=e.originalEvent.touches ? e.originalEvent.touches[0].pageX: e.pageX,currentDistance=(startX===0) ? 0: Math.abs(currentX-startX),// allow if movement < 1 seccurrentTime=e.timeStamp;if(startTime!==0&¤tTime-startTime<maxTime&¤tDistance>maxDistance){if(currentX<startX){// swipe left code hereapi.goForward();}if(currentX>startX){// swipe right code hereapi.goBack();}startTime=0;startX=0;}});}else{// Disable Image Dragging$("#slider img").mousedown(function(){returnfalse;});};});
Activity
Mottie commentedon Nov 7, 2012
Hi action-simon!
I don't have an iPad, but I think just touching the outer panels or the arrows would change the slide. Or do you mean you'd like swipe support?
action-simon commentedon Nov 7, 2012
Hello!
Yes I am taking about the swipe support. Touching the arrows or the outer areas does work of course ;)
Mottie commentedon Nov 7, 2012
Ok, I'll look into making a demo for you soon... I have other distractions today =(
action-simon commentedon Nov 7, 2012
Oh many thanks in advance! Very nice from you.
Mottie commentedon Nov 9, 2012
Ok, here is a demo of swipe support... it's a bit of code, but all you need to do is include it inside of a document ready event with the correct
target- check out the demo:If you are using an older version of jQuery (before v1.7), then replace the
onfunctions withbind.action-simon commentedon Nov 9, 2012
Oh thank you so much!! Very nice support from you, I have to say.
action-simon commentedon Nov 12, 2012
Hello. It is me again.
Finally I had time to implement it on the site, but now I have the problem that only Swipe is working on the Movingbox with the ipad.
If i click on the non active slides or the nav arrows or thumbnails nothing happens. On PC it is still working.
Edit: It is the same issue on the demo you have posted as well just to be sure it is not on my end ;)
It seems that all href links are not working. (Within slider div)
Mottie commentedon Nov 12, 2012
Try changing the
api.$wraptoapi.$windowand see if that fixes it :)action-simon commentedon Nov 12, 2012
Oh wow. Many thanks. It is working like a charm now.
Edit: Links are working on the Thumbnails and arrows now. But still not on the Slides itself.
Mottie commentedon Nov 12, 2012
LOL ok, lets go one more level deep... change the code to
api.$panelsaction-simon commentedon Nov 13, 2012
Nope. I'm afraid thats not working.
Maybe it is useful posting the complete js?
Mottie commentedon Nov 13, 2012
I think that code is just missing a comma before the
preinitfunction (updated demo)action-simon commentedon Nov 15, 2012
Sorry for the delay but I was busy. ;) I had already this comma in my JS. Maybe I made a mistake copy/pasting the code in here.
So sadly it is still not working.
Oh and the links are only clickable on the arrows and thumbnails. So the links next to the active slide are not working as well.
Mottie commentedon Nov 15, 2012
Well, all I can think of is to remove the
e.preventDefault();from the start event.action-simon commentedon Nov 15, 2012
Oh many thanks! Finally it is working like I want. Thank you very much. :)