How do you Pass Mouse Events through DIV element to the DIV element beneath it?

Discussion in 'Javascript' started by CRPietschmann, Apr 27, 2006.

  1. I'm using the Microsoft Virtual Earth Version 1 Commercial Control.
    I want to make it so you can click on a pinpoint that's plotted on the
    map and all mouse events are passed to the map so that the user can
    click anywhere on the map (including the pin points) and drag/zoom the
    map around.

    For those of you who haven't used Virtual Earth:
    Basically, there are a bunch on absolutely positioned Div elements. I
    basically want to pass all mouse events from one absolutely positioned
    div element to the absolutely positioned div element directly beneath
    it.

    Does anyone know how to do this?

    Thanks, in advance.
     
    CRPietschmann, Apr 27, 2006
    #1
    1. Advertisements

  2. CRPietschmann

    marss Guest

    I basically want to pass all mouse events from one absolutely positioned
    I'm not sure that there is a standard functionality to pass event from
    one absolutely positioned element to another.
    Maybe next trick helps you (but it works only in IE).
    You can attach event handler to upper div and find lower div in
    function that processing event.
    For example,

    html:
    <div onclick="onclick="ProcessClick(this);" ....

    javascript:
    function ProcessClick(sender)
    {
    //hide upper div
    sender.style.display="none";
    //get div directly beneath clicked one.
    var lowerDiv = document.elementFromPoint(event.clientX,
    event.clientY);
    //restore upper div
    sender.style.display="block";

    //here you have event and div directly beneath clicked one.
    ......
    }
     
    marss, Apr 28, 2006
    #2
    1. Advertisements

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.