[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?
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>.
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.
Users Browsing this Thread
There are currently 1 users browsing this thread. (0 members and 1 guests)