如何将animateProperty用于TextBox背景高亮显示
How to use animateProperty for TextBox background highlight?
我正在尝试为dijit/form/TextBox
的属性(backgroundColor
)设置动画。当这不起作用时,我开始拔头发:
var node = dom.byId("myTextBox");
fx.animateProperty( {
node : node,
duration : 750,
properties : {
backgroundColor : {
start : "yellow"
}
}
}).play();
然而,这是有效的:
var node = dom.byId("myTextBox");
fx.animateProperty( {
node : node.parentNode.parentNode, // grandparent of "myTextBox"
duration : 750,
properties : {
backgroundColor : {
start : "yellow"
}
}
}).play();
它应该是这样工作的吗?本页上的示例不需要,但也没有使用TextBox。
附带问题:JQueryUI的highlight
效应有更直接的等价物吗?这就是我要做的。
您最好使用dijit.byId("myTextBox")
获取对小部件对象的引用。然后,您可以仅参考myTextBox.domNode
或myTextBox.focusNode
,具体取决于您要突出显示的内容。我不确定您是想突出显示实际的文本输入区域还是背景,但这个简单的jsfiddle演示了两者。您的代码将被更改为类似以下内容:
var textbox = dijit.byId("myTextBox");
fx.animateProperty( {
node : textbox.focusNode // If you are trying to highlight the input background
duration : 750,
properties : {
backgroundColor : {
start : "yellow"
}
}
}).play();
相关文章:
- 从桌面读取python文件时高亮显示代码
- 高亮显示时编辑文本大小和颜色
- Angularjs-utils高亮过滤器在搜索时破坏应用程序
- 高亮显示与数组字符串一起使用时文本插件中断
- FF视图源|脚本高亮显示为红色
- 父页面的角度路由器导航高亮显示
- OpenLayers在悬停时高亮显示功能,并在单击时选择
- 当DIV中的文本高亮显示时,如何获得DIV中Span的值?(Javascript)
- 延迟高亮显示文本区域中的文本
- Mootools:如何在点击时保持元素高亮显示并停止所有事件
- 高亮显示单击菜单链接
- 在字符串列表中搜索任何出现的单词,如果单词的第一个字符匹配,则高亮匹配单词.Javascript正则表达式
- Firefox-当不在输入控件上时隐藏焦点高亮显示
- 高亮显示包含<br>以及重新格式化网格
- 使用下拉选择菜单高亮显示一行表格单元格
- javascript高亮文本字符串
- 如何限制javascript高亮显示函数的使用次数
- 在GXT中激活上下文菜单时,如何保持选中的文本高亮显示?(EXT GWT 2.x)
- 高亮显示背景窗格大于链接对象且没有填充的链接
- 如何将animateProperty用于TextBox背景高亮显示