95
rated 0 times
[
98]
[
3]
/ answers: 1 / hits: 36087
/ 9 Years ago, wed, january 13, 2016, 12:00:00
setTimeout(function() {
$.ajax({
url : handlers/H_AnnotationHandler.php,
data : case_id=<?=$case_id?>&plink=<?=$plink?>&mode=get,
type : post,
dataType : json,
success : function (response) {
if (!response.error) {
annotation_length = response.annots.length;
for (var i = 0; i < response.annots.length; i++) {
var elt = document.createElement(div);
elt.id = runtime-overlay + i;
elt.className = highlight;
viewer.addOverlay({
element: elt,
location : viewer.viewport.imageToViewportRectangle(parseInt(response.annots[i].rect_x), parseInt(response.annots[i].rect_y), parseInt(response.annots[i].rect_w), parseInt(response.annots[i].rect_h))
});
$(#runtime-overlay+i).attr(onclick, $.clickOverlay('+i+'));
}
}
}
});
}, 3000);
$.clickOverlay = function(whichOverlay) {
var flag = 0;
$(#runtime-overlay+whichOverlay).addEventListener(mousedown, function(){
flag = 0;
}, false);
$(#runtime-overlay+whichOverlay).addEventListener(mousemove, function(){
flag = 1;
}, false);
$(#runtime-overlay+whichOverlay).addEventListener(mouseup, function(){
if(flag === 0){
console.log(click);
}
else if(flag === 1){
console.log(drag);
}
}, false);
}
Why i get an type error for addeventlistener ?
Can you help me, i try to understand click or drag.
so i added that functions in my click event :
How to distinguish mouse "click" and "drag"
ERROR : Uncaught TypeError: $(...).addEventListener is not a function
More From » javascript