문제

I have a jQuery mobile list. I'd like to make the list elements highlight when the user touches them. I tried to implement this using:

$("#id").bind('touchstart tap', function () {
    $("#id").css('background', 'blue');
    window.setTimeout(function () {
        $("#" + fbId).css('background', 'hsl(0, 0%, 93%)');
    }, 65);
}

This works only too well. When the user scrolls the it doesn't differentiate between the scroll and touch start and the element lights up. Can anyone suggest a cleaner way of accomplishing this?

도움이 되었습니까?

해결책

The handlers below did the trick.

   $("#" + Id).bind('touchstart', function () {
        $("#" + Id).css('background', 'highlight-color');
    });

    $("#" + Id).bind('touchend', function () {
        $("#" + Id).css("background", "original-color");
    });
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top