简体   繁体   English

防止单击时突出显示IconMenuIcon

[英]prevent IconMenuIcon from being highlighted when clicked

I am using html, javascript and the dojo library. 我正在使用html,javascript和dojo库。

What I have is a IconMenu with 6 IconMenuItems. 我所拥有的是具有6个IconMenuItems的IconMenu。 Now, whenever I click a IconMenuIcon it gets highlighted but I want to prevent the highlighting effect. 现在,每当我单击IconMenuIcon时,它都会突出显示,但我想防止突出显示效果。 IconMenuIcon has the property "selected" which gets set to "true" on the click event and I think this is the cause of the highlighting. IconMenuIcon的属性“ selected”在单击事件中设置为“ true”,我认为这是突出显示的原因。

I now tried to do the following on every "on" function (onclick, onmouseover etc) dojo offers: 我现在尝试在dojo提供的每个“ on”功能(onclick,onmouseover等)上执行以下操作:

this.set("selected", false); this.set(“ selected”,false);

unfortunately the IconMenuItem still gets highlighted -.- 不幸的是IconMenuItem仍然突出显示-.-

EDIT: here is the code of the widget: 编辑:这是小部件的代码:

http://svn.dojotoolkit.org/src/dojox/trunk/mobile/IconMenuItem.js http://svn.dojotoolkit.org/src/dojox/trunk/mobile/IconMenuItem.js

It has this propertie: 它具有以下特性:

selColor: "mblIconMenuItemSel" selColor:“ mblIconMenuItemSel”

how can I set it to luicid? 如何设置为luicid?

还没有使用过dojo,但我认为突出显示是通过CSS完成的,请看一下应用于“ selected”元素的类,看看它是否与突出显示样式匹配并根据需要进行编辑。

Thanks to the kind people in the official dojo irc I came to this simple piece of javascript. 多亏了官方dojo irc中的好心人,我才有了这个简单的javascript。 The ItemMenuItem has a property which determines the highlighting color: ItemMenuItem具有确定突出显示颜色的属性:

dojo.ready(function(){ // logic that is executed when dojo is ready goes here alert("dojo.ready"); dojo.ready(function(){// dojo准备就绪时执行的逻辑会在此处发出alert(“ dojo.ready”);

var portalButton1 = dijit.byId("portalButton1"); var portalButton1 = dijit.byId(“ portalButton1”); portalButton1.set("selColor", "RED"); portalButton1.set(“ selColor”,“ RED”);

}); });

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM