Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3219154
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 17, 20262026-05-17T15:36:44+00:00 2026-05-17T15:36:44+00:00

Having discovered that IE does not handle javascript onmouseout , I’m determined to use

  • 0

Having discovered that IE does not handle javascript onmouseout, I’m determined to use jQuery instead so the cross-browser compatibility would be taken care of automatically. I am making an area defined by an svg path light up when the mouse hovers over it, and I adapted the code provided on the Raphael website from the Australia example.

In this code, each state of Australia is defined by a Raphael path, for example Tasmania:

 aus.tas = R.path("...").attr(attr);

This path (‘st’) is then passed to the function:

st[0].onmouseover = function () {
    ...
};

Contrary to what I would have expected, the code is st[0].onmouseover as opposed to merely st.onmouseover. Thus, the path must actually be an array, and st[0], whatever that is, is the thing that is hovered over.

In order to replace onmouseover with the jQuery equivalent (which I believe is .mouseout()), I need to assign a class to st[0] so I can refer to it with jQuery. My question is, how do I do that? If the code was st.onmouseover it would be straightforward, but why is the path (st) an array? What exactly is st[0]? And how the heck do I get to it?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-17T15:36:44+00:00Added an answer on May 17, 2026 at 3:36 pm

    Note: That demo was made with an old version of Raphael. Now Raphael has its own custom event handlers including .mouseover() and .hover().


    The short of it:

    Simply wrap the DOM Object to make a jQuery Object out of it, or use the Raphael built in custom event handlers:

    $(st[0]).mouseover( ... );            // This uses the jQuery .mouseover() method
    

    Or, probably more convenient, and IE supported:

    $(st[0]).hover( ... );                //     This uses the jQuery .hover() method
    

    Or, using a Raphael built in event handler method:

    st.mouseover( ... );                 // This uses the Raphael .mouseover() method
    st.hover( ... );                     //     This uses the Raphael .hover() method
    

    The long of it:

    You can get the reference to the DOM object to work on using node or [0], since RaphaelObject[0] is always the reference to the DOM element:

    aus.tas = R.path("...").attr(attr);
    
    // aus.tas is a Raphael object
    // aus.tas[0] is aus.tas.node is the reference to the DOM Object
    
    $(aus.tas[0]).mouseover(function() {          // Could have also use aus.tas.node
        ...
    });
    
    // Raphael now has custom event handlers
    aus.tas.mouseover(function() {
        ...
    });
    aus.tas.hover(function() {
        ...
    }, function() {
        ...
    });
    

    So, with you function:

    (function (st, state) {
          // st is a Raphael Object
          // st[0] is st.node is the reference to the DOM Object
    
          // This is now using jQuery for mouseover!
        $(st[0]).mouseover(function() {
            ...
        });
        ...
    })(aus[state], state);
    

    Additionally, I would suggest looking into the jQuery .hover() function, which does handle IE quite nicely:

    (function (st, state) {
          // This is now using jQuery not Raphael for hover!
        $(st[0]).hover(function() {
            ... // the mouseenter function
        }, function() {
            ... // the mouseleave function
        });
        ...
    })(aus[state], state);
    

    As a simplified demonstration, here is how to bind mouseenter and mouseout using .hover() to a Raphael element (tested in IE 8):

    ​$(function() {
        var elie, paper = Raphael("canvas", 500, 500); 
    
          // Create Raphael element
        elie = paper.rect(0,0,100,100).attr("fill","#000");
    
          // Get reference to DOM object using .node and bind
          //     mouseover and mouseout to it:
        $(elie[0]).hover(function() {
            elie.attr("fill","#FFF");
        },function() {
            elie.attr("fill","#000");    
        });
    });​
    

    Try it out with this jsFiddle

    Additionally, the Raphael .hover() method seem to work in IE too.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Having trouble accessing javascript code in a mixed html/js ajax response. jQuery ajax doc
I've recently discovered that my app malfunctions on Win 7 machines because it does
I'm revising code I did not write that uses JavaMail, and having a little
Having recently discovered design patterns, and having acquired the excellent Head First Design Patterns
I just discovered on my site using magento 1.3.2.2 that on a bundled product,
i'm working on a jquery mobile web site. and am trying to use the
I've discovered that PayPal has quite an attractive micropayment system in comparison to other
Having an issue with a Windows service that needs to monitor/have access to a
I've developed an lwip client on a microcontroller that does seem to successfully acquire
I recently discovered that the :invalid pseudo-class applies to required form elements as soon

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.