Categories | Question details Back To List | ||||||||||||||
context menu on a link or image Hi! I want a context menu on right click event for a link or image rather than any node of a dhtmlx tree & pass related arguments from the links or images to the event handling function. Is it possible?? If yes please write detail. Example: I want to pass the id of the image( of <img> tag)of an image link to the handler. Thanks a lot. Answer posted by Support on Feb 23, 2009 06:07 If you want to use context menu against any element on page, you can use its own API , which allow to attach menu to any DOM element. Please check http://dhtmlx.com/docs/products/dhtmlxMenu/doc/guide.html#menu_mf 3.1.3 Contextual Menu Zones section Answer posted by ZedR on Feb 24, 2009 09:23 I tried using the code from samples. I am using php page. But the menu does not appear in proper position .It is displayed at the end of the page on the left. I used exactly the same code in my page but is not working properly. What could be the problem? Is php creating problem?? <div id="78" style="position: absolute; left: 100px; top: 100px; width: 100px; height: 60px; border: #C1C1C1 1px solid; background-color: #E7F4FF;">zone A</div> /* inside script tag under body*/ menu_img = new dhtmlXMenuObject(); menu_img.setImagePath("../dhtmlxMenu/codebase/imgs/"); menu_img.setIconsPath("../samples/images/"); menu_img.renderAsContextMenu(); //menu_img.setOpenMode("web"); menu_img.loadXML("_context_img.xml"); menu_img.addContextZone("78"); </script> Answer posted by Support on Feb 25, 2009 02:57 Probably you miss css menu files. Here is a completed demo. Attachments (1)
Answer posted by ZedR on Feb 25, 2009 03:23 Oh I found the problem.The problem is in the css file I used i.e. dhtmlxmenu_aqua_sky.css . The demo has dhtmlxmenu_dhx_blue.css. Thanks for the info. Can you fix this issue & send me aqua_sky css file? I am using dthmlx 2.0 new release. thnx. I have even attached that css file. Attachments (1)
Answer posted by ZedR on Feb 25, 2009 03:33 OOPS! Please ignore the previous answer.Sorry for that. I confirmed the problem. I didnt provide the skin name in dhtmlXMenuObject & so it looked for the default css file dhtmlxmenu_dhx_blue.css which I didnt include it in script .I included aqua_sky instead of that. Thanks. The problem is solved. |