Results 1 to 2 of 2

Thread: [RESOLVED] getting a context menu to scroll with the page

  1. #1
    Join Date
    Oct 2009

    resolved [RESOLVED] getting a context menu to scroll with the page

    I've created a table and coded the oncontextmenu event of the <tr> elements to return false. I've coded the onmouseup events of same to display an absolutely positioned div with z-index of 1 as a context menu whenever the <tr> element is right-clicked. The problem is when I scroll the page the context menu remains in the same place in the browser window, although the <tr> element it refers to scrolls up out of sight. How can I make a context menu that will remain in the same position relative to its <tr> element, even when the page scrolls?

    Possibly Relevant:

    I use the document.createElement() method to create the div, then use the appendChild() method to add it to the <td> element of the <tr>.

  2. #2
    Join Date
    Oct 2009
    Found a solution afterwords.

    First, it turned out that I was NOT using absolute positioning but fixed positioning. So I changed it to absolute. Secondly I was using the event.clientY property of the mouse pointer when I should have been using the event.pageY property to determine the vertical position of the context menu. Now everything works fine.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
HTML5 Development Center