Saola swipe on window

In a previous post, you show how to bind the swipe up / down events and this works great for swiping actions on the whole scene.

However, when a project doesn’t fit the whole viewport, I’m finding users are trying to swipe from outside of the swipe area - which fails.

Is it possible to attach the Saola swipe function to window / body?

Hi mackavi,

Sorry for the late reply.
You can try the following trick: insert a div element, set its display to off so that it doesn’t appear on the scene, set its dom to document.body and bind swipe event to this element.

var bodyElement = doc.getElement('Div_1');
bodyElement.dom = document.body;
bodyElement.bind('swipeleft', function(doc, e) {
   	// code to handle the event here
});

It works fine in a quick test but I’m not sure if it causes any other effects, please check it thoroughly.

Regards

Genius idea. Working well for Galaxy Tab and iPad.

1 Like