[英]How do I assign custom classes to YUI3 plugin/widget objects
Consider the following code. 考虑以下代码。
var overlay = new Y.Overlay({
id:'tooltip-tag',
bodyContent:"Loading.....",
xy:[e.target.getX(),e.target.getY()+30]
});
The overlay gets the id as given in attributes. 叠加层获取属性中指定的ID。 But what if I want to add a class ?
但是,如果我想添加课程怎么办?
IS there something like: 是否有类似的东西:
var overlay = new Y.Overlay({
**class:'tooltip-tag'**,
bodyContent:"Loading.....",
xy:[e.target.getX(),e.target.getY()+30]
});
No. Here are three ways to do what you want: 否。这是您想要做的三种方式:
className
config attribute. className
配置属性。 If you have other customization to do, this is an attractive option. overlay:render
event and attach the class there. overlay:render
事件并将类附加到那里。 Here's a jsfiddle that demonstrates this technique: http://jsfiddle.net/4zN5M/1/
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.