views:

52

answers:

2

I have an div Element with the ID mypointer, wich has an absolute position. I animate this div on a page with jquery. The goal is a presentation where the elements show the same reaktion on the div element like the mousepointer. So I want to simulate mouseover, click and rightclick events. Is that possible? Can someone give me an example which show me how to do that?

Thank you for your answers

Lara

P.S. Example here link text the red square is over an h1 element. Is it possible to execute the h1 mouseover event, when there is a collision of the mypointer and an h1 element?

A: 

I'm not quite sure if I get you well, but to 'simulate' events like mouseover et cetera, you can always use jQuery's .trigger() in a form like:

$('#my_div_id').trigger('mouseover');

You can also call a more 'detailed' version, where you can specify the events arguments

$('#my_div_id').trigger({
   type:    'keypress',
   which:   13,
   ctrlKey: true
});

which infact would simulate a return key while ctrl key is pressed to 'my_div_id'. If you just need the event handler code to execute, use .triggerHandler().

jAndy
A: 
sbmaxx
Thank you for you work.I did not search for an element mypointer which reacts to my mousepointer and trigger the events to an other element. I ask for the possibility that an other element react to mypointer like to the mousepointer
Lara Röpnack
Element react to mouse cursor?
sbmaxx