Inserting a class name dynamically on a component's wrapping element

…衆ロ難τιáo~ 提交于 2019-12-11 08:54:42

问题


I am using a cq:htmlTag to generate a custom tag for one of the components.

For the "class" property, I know that I could provide a static class name that is part of a CSS file, but my requirement is to have the 'template name' as the class property value.

Does CQ provide a way to use dynamic values?


回答1:


Out of the box I think not. There are a few workarounds that I could think of:

  • Add another tag as a child where you set that class (probably not what you want)
  • Use javascript to add it on load (if it is not to late)
  • Overlay the parsys and implement your logic there


来源:https://stackoverflow.com/questions/25755523/inserting-a-class-name-dynamically-on-a-components-wrapping-element

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!