Long click possible?

I’d like to do

  'longClick .className': function(){ }

Is that possible via Meteor? Or how can I get around this or hack where please?

If you are talking about this jquery plugin https://github.com/pisi/Longclick, then I think it should work if you listen to the longclick event, just like it is described in the Readme.

'longlick .className': function (event) {}

Thanks @slava. Not sure if I am willing to use a 4 year old jQuery plugin is a good idea. jQuery has a few API changes IIRC. Plus I’m not sure if this trys to get around the long-tap issue with mobile is addressed.

I’ll bookmark it, & see if I can learn something from it to maybe write my own.

from your original post, I wasn’t sure why you expect longclick to be handled at all? I thought it is not part of browser events.

I’d like to try to use that library you referenced. So being a newb to meteor I have performed these steps:

  1. I copied the jquery.longclick-min.js to my app folder

  2. Created a test href to click on: <a href="#" id=“test”>Test me</a>

  3. Wrote an event to make it log something to the console:

    Template.body.events({
    ‘click #test’:function(event,template) {
    console.log("Target: " + event.target.id);
    }
    });

and that was working great.

  1. Then as a Hail Mary, I switched click to longclick and … nothing, as you might imagine.

Any hints on what do I need to do to make the longclick( … ) function available to be used in the Template events section? Is there some javascript trick I could do to make it available?

I’d also like to know how to register custom events with Meteor (I’m trying to do the same thing… touchhold, longpress, etc.). Really needed to add a lot of additional functionality from hidden UI in my mobile app.

It looks as though you can get longpress functionality from hammer.js - see https://atmospherejs.com/chriswessels/hammer. I haven’t implemented it myself but its well documented on atmosphere, has been downloaded many times, and has been well star-rated.