This is a read-only archive of the Framer Community on Facebook.

What is Framer? Join the Community
Return to index
Craig Murray
Posted Nov 26 - Read on Facebook

Anyone figure out how to combat the delay on touch for mobile prototyping? I'm noticing an ever so subtle delay on my iPhone (using Clear Browser for fullscreen app simulation).

14 Comments

Aaron Carámbula

Julius Tarng Gave me the answer to this: fastclick.js

Craig Murray

Thanks Aaron Carámbula

James Muirhead

I use Hammer.js to provide proper touch and swipe detection.

Craig Murray

James Muirhead do you have an example we can reference?

James Muirhead

Here is the link to Hammer.js - http://eightmedia.github.io/hammer.js/

Here’s how it looks in my code:

In index.html:
<script src="hammer.js"></script>

In app.js:
//initialize Hammer touch events
hammertime = new Hammer(document.body);

//set up event listeners
Hammer(<object>).on("swipeleft", function(event) {
hideNavPanel();
});

Hammer(<object>).on(“touch", function(event) {
hideNavPanel();
});

Hope that helps.

Craig Murray

Thanks James Muirhead

Masato Miura

so if you want to swipeleft psd layer group called "test", then it would be something like below...?

Hammer(PSD.test).on("swipeleft", function(event) {
hideNavPanel();
});

James Muirhead

It needs to be a DOM object.

So more like this:

Hammer(document.getElementById(PSD.test.id).on("swipeleft", function(event) { hideNavPanel();
});

Masato Miura

Got it. Thank you so much!

Tisho Georgiev

You can also save yourself the getElementById call by doing:

Hammer(PSD.test._element).on('swipeleft', hideNavPanel)

Every Framer view has a "private" _element property which holds a reference to the DOM element it uses to render itself.

James Muirhead

!

Koen Bok

Tisho you are right with _element, but view.on should actually forward dom event listeners to the actual element so you should be able to do Hammer(PSD.test).on('swipeleft', hideNavPanel) too.

https://github.com/koenbok/Framer/blob/master/src/views/view.coffee#L503

Tisho Georgiev

Koen, the .on is being called on the hammer-wrapped object, though, not the framer view. That's why you need _element in there.

Koen Bok

Ah, understood :-)

Read the entire post on Facebook