473,378 Members | 1,451 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,378 software developers and data experts.

Context menu item link still selected after click

Hi

Here's my problem - I've been trying to figure this out for a while and ran out of ideas...
  • <div> id1 contains <div> id2 (a geographical map)
  • <div> id2 contains a context menu made out of an <ul> list. the context menu operations work fine, links are hovered, etc
  • When I click one context menu items named "view large", <div> id2 is moved to another parent element, <div> id3 and resized. The move is performed using appendChild()
It all works, but when I right click on the new, larger map, the "view large" context menu item is functional, but still selected. It seems to me that the only cause for this behavior is the fact that the id2 object has changed parents, because the other context menu operations end with deselecting the menu.

The context menu styles are controlled with CSS. The menu class is "pmenu". The unselected item is "ul.pmenu li a" and the selected one is " ul.pmenu li a:hover". It looks like the link never becomes "unhovered" when the parent is removed and placed somewhere else.

You can see all this at http://travelrats.blogspot.com. Right click on the map and select "view large map". Then on the large map, right click again - the name of the menu item changes to "back to blog", but it is still selected.

Any ideas will be highly appreciated
Thanks,
Fritz
Feb 3 '07 #1
2 2424
No reply to my post but I think I have an idea; even if I still lack a deep understanding of the inner works of the html DOM, at least I was able to fix the problem.

In case anybody is interested: the menu item link stays selected because the menu <ul> node itself is moved together with the <div> map container, to a different parent node in the document, before the "onclick" operation is completed. Therefore, IE is unable to notify the link that the operation has completed and it is no longer in the ":hover" state. I'm not sure how that mechanism really works, but it seems common sense. I have not been able to call anchor.blur() explicitly and make it lose focus.

The fix is simple: do not move the context menu <ul> element together with the <div> element containing the map. Leave the menu anywhere on the page in a container that is not being moved or made invisible - this way it can be used by the large map and the small map containers, and since it is not moved with the map, the operation can complete and the link is de-selected.

Cheers,
Fritz
http://travelrats.blogspot.com
Feb 4 '07 #2
acoder
16,027 Expert Mod 8TB
Hi Fritz

Thanks for that info.
Feb 5 '07 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

4
by: Mohit Gupta | last post by:
Hi all, Lately I have been working on an application in VB .net CF for Pocket PC device. I have a small question about Context Menu. When I try to close the window after context menu is poped...
0
by: Roman Muntyanu | last post by:
Hi all, I wrote add-in that can do different job for files with different extension. When I do right click on the file I see all my custom menuItems in context menu of solution explorer for all...
5
by: yxq | last post by:
Hi I am build vb6 Context menu extension, but how to determine which popup menu item(popupItem1 and popupItem2) was clicked? Thanks The code ' ' IContextMenu::QueryContextMenu '
8
by: Sameh Ahmed | last post by:
Hello there i have a context menu linmked to a listview control. I want the context mnu to appear ONLY when i right click on an item and not any place in listview. any ideas? Thanks in advance....
2
by: gilad | last post by:
Hi, I seem to be having a problem getting a context menu to work in Explorer. The menu item installs fine, but when I click it a message box should pop up indicating the command was received and...
4
by: Karl | last post by:
Hi all, I want to write an application that is launched from the context menu in Windows Explorer/Computer. That is to say, when I am browsing around my hard drive and get to any location I...
4
by: PW | last post by:
Hi, What is one and does Access 2003 have one? Or how would I create one? I would like the user to be able to right-click on a form or a control on a form and have a menu that offers to go to a...
0
by: EvilProject | last post by:
Hi im writing a class of a context menu where each menu item is linked to a Tree Node. I have a click event (that belongs to the context menu class ,not the menu item class) that it's event...
2
by: dharmbhav | last post by:
Hello all, I am trying to develop a roll-over menu effect on a page. It works fine with all other browsers except IE6. Can some one please help me? HTML: <div class="menu-item-wrap">...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.