This forum uses cookies
This forum makes use of cookies to store your login information if you are registered, and your last visit if you are not. Cookies are small text documents stored on your computer; the cookies set by this forum can only be used on this website and pose no security risk. Cookies on this forum also track the specific topics you have read and when you last read them. Please confirm that you accept these cookies being set.

Long click in Custom JS
#3
Thanks for your answer but unfortunately in this example default click is unbinded(.off("vclick")) but I want not remove anything but only add long press action and when long press will be detected then only this long press should execute, but when original short click will be triggered then original action should also work.

I've tried a few options and this is enough for adding second event which trigger some other action than default:
Code:
let lastMousedown;
       motionsIcons.on("vmousedown",function(e) {
         lastMousedown = e.timeStamp;
       });
       
       motionsIcons.on("vmouseout",function(e) {
         let currentMouseout = e.timeStamp;
         
         if ((currentMouseout - lastMousedown) > 1000 && (currentMouseout - lastMousedown) < 3000) {
           let value = grp.getvalue(motion.disabling);
           grp.write(motion.disabling, !value);
         }
       });
Reply


Messages In This Thread
Long click in Custom JS - by buuuudzik - 06.02.2018, 14:13
RE: Long click in Custom JS - by Daniel - 06.02.2018, 15:59
RE: Long click in Custom JS - by buuuudzik - 06.02.2018, 16:11
RE: Long click in Custom JS - by buuuudzik - 06.02.2018, 20:26
RE: Long click in Custom JS - by admin - 08.02.2018, 09:32

Forum Jump: