I load this simplified example when my page load. And when I have mousedown on an image it is showing the alert as it should.
wookmark();
function wookmark(){
$$(".wookmarkpopover").mousedown(function(){
app.dialog.alert("mousedown test")
});
}
But when I load new items to my list with infinite-scroll then when I try to mousedown on the images, then it is not running the funktion even if I call the function after the infinite scroll is finished loading.
And this is my full code.
wookmark();//so I run this when the infinite -scroll has finished----
function wookmark(){
console.log('wookmark funktionen körs')
tapHoldFlag = false;
var wookmarkpopover;
var pressTimer;
$$(".wookmarkpopover").mousedown(function(){
app.dialog.alert("mousedown 111")
pressTimer = setTimeout(function() {
wookmarkpopover.open();
tapHoldFlag = true;
},300);
return false;
}).mouseup(function(){
clearTimeout(pressTimer);
return false;
});
}
So why is it working the first time and not when the new items has been added?
Any input really appreciated, thanks.
Thanks Overman.
But Im getting that "TypeError: undefined is not an object (evaluating 'target.mousedown')"
So it is not finding the .wookmarkpopover objects?
Yes thank you but the problem was not the first time, that was working, it was after I used the infinite scroll function.
But I got it working, thanks again.