마우스로 잡고 스크롤을 하도록 만들었는데
링크가 걸린 이미지를 잡았다 스크롤(드래그)후 때면 링크로 바로 연결되어 버립니다. ㅠㅠ
마우스를 잡았다 땔때 링크로 바로 연결되지 않고 클릭했을때만
링크로 넘어갈 수 있도록 가능할까요? ㅠㅠ
var dragFlag = false;
var x, y, pre_x, pre_y;
$(function () {
$('#tab1').mousedown(
function (e) {
dragFlag = true;
var obj = $(this);
x = obj.scrollLeft();
y = obj.scrollTop();
pre_x = e.screenX;
pre_y = e.screenY;
onclick=false;
$(this).css("cursor", "pointer");
}
);
$('#tab1').mousemove(
function (e) {
if (dragFlag) {
var obj = $(this);
obj.scrollLeft(x - e.screenX + pre_x);
obj.scrollTop(y - e.screenY + pre_y);
//$('#result').text((x - e.screenX + pre_x) + "," + (y - e.screenY + pre_y));
return false;
}
});
$('#tab1').mouseup(
function () {
dragFlag = false;
$("#tab1").off("click");
$(this).css("cursor", "default");
return false;
}
);
});
답변 1개
답변을 작성하려면 로그인이 필요합니다.