سؤال

This question is outdated

The problem doesn't exist in newer versions of Chrome

I'm working on a drag-to-select jQuery plugin, which is working. The problem, is that on the touch screen, it just scrolls the page.

Chrome doesn't implement touchstart and other touch events, so I would assume mousedown would be triggered. Here's a simplified example:

fullscreen demo [ code ]

A coffeescript snippet:

$(document).on 'mousemove', (e) ->
  $('.follow').css
    left: e.pageX
    top: e.pageY

How can I get this to respond to touching the screen in Chrome on Windows 8?

هل كانت مفيدة؟

المحلول 2

This seems to be fixed in the latest versions of chrome. It's an evergreen browser, which mean nearly every user is on the current, or previous release of chrome.

نصائح أخرى

Not sure where you got your information, and your CodePen examples are not there to check what the problem may be, but Chrome not only implements touchstart, touchmove, touchend etc but I have found it to have the nicest touch support of all browsers I have used in the last year.

The only thing to ensure is that if you have two monitors, you start up the browser page on the touch screen.

I am using Windows 8.1 with a touch-screen for JQuery plugin development (to ensure it is all tablet enabled).

Test existence of touch with:

var hasTouch = (typeof TouchEvent !== "undefined");
alert(hasTouch);

This is some working TypeScript code straight out of one of my plugins (which works best on Chrome. IE is the problem-child for touch):

THIS.$element.on("touchstart", function (e)
{
    THIS.momentum.touchstart(e.originalEvent.touches[0].pageY);
});
THIS.$element.on("touchmove", function (e)
{
    THIS.momentum.touchMoveTo(e.originalEvent.touches[0].pageY);
});
THIS.$element.on("touchend", function (e)
{
    THIS.momentum.touchEnd();
});
مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top