How can i track if user has mouseover a element and rightclicks on the right x and y positions?
<div style="position:absolute;left:200px;top:200px">Hello</div>
<script>
if ( MOUSE == divPosition && RIGHTCLICKS on it) {
//Trigger a javascript function!
}
</script>
I really hope someone can help me.
It should first find the positions where the element is. After that a multi mouselistiner should track if user rightclicks on the specific position of the element. Without just making "oncontextmenu.." It should be done though jQuery or something, but i am stuck.
I have tried this and works fine, but it's only for "mouseover" element. It should be when user RIGHTCLICKS on the right position!
'wierdo' : function(id){
$("#item-" + id).each(function(){
boxX = $(this).offset().left;
boxY = $(this).offset().top;
boxW = $(this).innerWidth();
boxH = $(this).innerHeight();
if ((boxX <= mx) &&
(boxX + 1000 >= mx) &&
(boxY <= my) &&
(boxY + boxH >= my))
{
// mouse is over it so you can for example trigger a mouseenter event
alert("Yes....");
$("#item-" + id).trigger({type: "mousedown",which: 3});
//$(this).trigger("mouseenter");
}
});