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 6370605
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T00:57:07+00:00 2026-05-25T00:57:07+00:00

I have a setup where I have a grid of elements and when I

  • 0

I have a setup where I have a grid of elements and when I rollover each element a popup appears like an advanced tooltip. I first check if the popup needs to follow the moused over elements mouse position, if so I use a mousemove event. I first stopObserving in case there was one set before, then I start observing. Do I really need to do this or is prototype smart enough to not to add duplicate events on the same element.

 show:function(param){
      if(this.isFollow){
        $(param.target).stopObserving('mousemove', this.onMouseMove);
        $(param.target).observe('mousemove', this.onMouseMove);
      }
},

//param.target is the element that is being rolled over. I pass this in to my show method to then find its x and y position.

 onMouseMove:function(event){
    var xPos = Event.pointerX(event);
    var yPos = Event.pointerY(event);
    _self._popup.setStyle({left: xPos + 10 + "px", top:yPos + 10 + "px"});
 }

Second question. When I move my mouse across the elements really fast my popup that is following the mouse sometimes lags and the mouse goes over the popup obstructing the mouseover event on the element below it.
I presume this is the nature of the mousemove as its not rendering fast enough. Should I be using setTimeout or something like that instead of mousemove, to prevent this lag.

  • 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-25T00:57:08+00:00Added an answer on May 25, 2026 at 12:57 am

    1) No, Prototype won’t set the same event handler twice. It’ll only happen if you declare your handler function in-line (i.e. element.observe('click', function(){…})) since the handler will be sent a newly created function each time, and never the exact same instance of a function.
    But in your case, where you’re referring to the onMouseMove function, Prototype will check whether that particular function is already registered for that particular event, on that particular element. And if it is, it won’t be registered again.

    2) You can’t avoid the lag on fast mouse movements, no. The browser won’t send the mousemove events fast enough. You could use a timer, but I’d probably try registering a single mousemove handler for the parent element of all the grid-elements (or maybe even document itself), and use the X/Y coordinates to figure out which grid-element to show the tooltip for. Then you don’t have to bother with setting event handlers for each element. I.e. if the grid was a standard table, I’d listen for events on the <table> element itself, rather than on each and every <td>. Especially if you still want to implement a timer, I should think, it’d be easier to deal with everything in one place (otherwise, a timer might accidentally execute on some element you’ve already moused out of, and your tooltip will flicker back and forth or something. If you only want 1 tooltip at a time, it’s easier to manage it in 1 place.)

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

Sidebar

Related Questions

I have a databound ListBox with a DataTemplate setup. The DataTemplate contains a Grid
I have setup a property and implement INotifyPropertyChanged like so... public event PropertyChangedEventHandler PropertyChanged;
I have setup coredata in my appDelegate, but it first loads the mainWindow.xib and
We have a grid setup that has a column which can contain very large
I have GridView and this grid has setup paging, but this paging not show
I have the following setup: A grid of 4x4 (16 total) buttons (standard NSButton
In my selenium grid setup, I have to execute 2 modules initially, which will
I have the following setup on my WPF UserControl: <GroupBox> <Grid> ... <Grid> <Grid.ColumnDefinitions>
I have a TreeView setup so that each TreeViewItem has right-click context menu applied
I have 12 ImageButtons setup in a 3x4 grid using an AbsoluteLayout. When the

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.