Hello,
I need the control-click operation to open the menu option in a new tab, but I doesn’t work. I’ve been looking for a controlClick event, but couldn’t find one.
Also, is there a better way to embed a link in a menu option (like href used to work for the previous version of dhtmlxMenu) ? Using html inside the text element takes more space than just using the deprecated href parameter.
Here’s my code:
<?xml version="1.0"?>
<item id=“m0.1.1” text='Start’text=“Start” img=“wi0149-16.png”>
<item id=“m0.2.1” text='My Profile’text=“My Profile” img=“ac0021-16.png”>
<item id=“m0.3.1” text='Show Perfil’text=“Show Perfil”/>
<item id=“m1.3.2” text='My Searches’text=“My Searches”/>
Hello,
For the moment dhtmlxMenu 2.0 does not support href as a independent attribute.
Control-click also absent. Probably it will added in future version.
Is it possible to implement the right-click to open in a new tab?
Source codes need to be fixed.
You can try do it yourself. Edit the dhtmlxmenu.js file:
m.onclick = function(e) {
…
main_self._doOnClick(…
…
}
k.onclick = function(e) {
…
}
I did change it:
this._doOnClick = function(id, type) {
this.menuLastClicked = id;
link=this.getItemLink(id);
if(link!="") window.location=link;
return;
I just don’t know how to detect right-click… I’ve tried this:
this._doOnClick = function(id, type, e) {
this.menuLastClicked = id;
link=this.getItemLink(id);
if(link!="")
{
if (e.button == 2)
{
alert(1);
}
else
{
window.location=link;
}
}
return;
… in m.onclick = function(e) {
main_self._doOnClick(this.id.replace(main_self.idPrefix, “”), tc+td+“t”, e);
… in k.onclick = function(e) {
case “item”:
main_self._doOnClick(this.id.replace(main_self.idPrefix, “”), tc+td+“n”, e);
Your code is correct, then in event handler you should parse 3rd incoming argument like this:
menu.attachEvent(“onClick”, function(id, t, e){
// parsing event
if (e.ctrlKey) {
// was pressed
} else {
// was not pressed
}
});