Path: csiph.com!usenet.blueworldhosting.com!feeder01.blueworldhosting.com!border2.nntp.dca1.giganews.com!nntp.giganews.com!buffer2.nntp.dca1.giganews.com!buffer1.nntp.dca1.giganews.com!nntp.westnet.com.au!news.westnet.com.au.POSTED!not-for-mail NNTP-Posting-Date: Fri, 16 Sep 2016 03:26:13 -0500 Newsgroups: comp.lang.javascript X-Mozilla-News-Host: news://news.iinet.net.au:119 From: Andrew Poulos Subject: Differentiate between touch start and click Date: Fri, 16 Sep 2016 18:26:16 +1000 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:45.0) Gecko/20100101 Thunderbird/45.3.0 MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Message-ID: Lines: 19 X-Usenet-Provider: http://www.giganews.com NNTP-Posting-Host: 124.170.204.214 X-Trace: sv3-Q9aNmTPz3h5DrppxcxVdto5vgrErd+kNeLR9Ynkz6fYHKPCL+O2hTvATKzVzgjTwWYv2gKLWhYLQueV!mp4I97vAe+036EPjGeB/l1h+aktaRaJTYSOpNULcJI0qDP3I2j6znRXQxBg/n5gOMWqpUhGs7Uz2!cvyjt7vrjCwdHQPlTFnhTHE= X-Complaints-To: abuse@westnet.com.au X-Abuse-and-DMCA-Info: Please be sure to forward a copy of ALL headers X-Abuse-and-DMCA-Info: Otherwise we will be unable to process your complaint properly X-Postfilter: 1.3.40 X-Original-Bytes: 1740 Xref: csiph.com comp.lang.javascript:31381 I have a touchstart event and a click event both triggering this function function checkTrigger(e){ if (e.type != "click") { e = e.touches[0]; } var elem = document.elementFromPoint(e.pageX - window.pageXOffset, e.pageY - window.pageYOffset); ... } To tell whether it was a touchstart or a click I'm using (e.type != "click") is that the right way to differentiate between the two or should I have two smaller functions (one for each event) which then pass on the relevant values to checkTrigger? Andrew Poulos