液体:使用动态变量作为ARIA扩展的属性
我有一个带标签的液体页面。这是下拉菜单的一个元素,因此可以扩展。为此,我想添加atia扩展的
属性。
方案 - 用户悬停菜单信息:aria-expanded = true
,on blur aria-expanded = false
。 ARIA扩展的
应该是动态的。
我的摘要:
<li>
{% assign menuExpanded = false %}
<a class="ch-wp-menu-item-link"
href="{{item.value}}"
onclick="return cityHiveMenuItemLinkClicked(event)"
onmouseover={% assign menuExpanded = true %}
onblur="{{menuExpanded = false}}"
aria-expanded="{{menuExpanded}}">
My menu item
</a>
</li>
我遇到的问题是,我不能仅使用&lt; script&gt;
标签,在那里创建一个变量,然后在模板本身中使用它。
这里有什么解决方案?谢谢你!
I have a liquid page with the tag . This is an element of the drop-down menu so it may expand. For that purpose, I want to add aria-expanded
attribute.
Scenario - user hovers the menu-item: aria-expanded=true
, on blur aria-expanded=false
. aria-expanded
should be dynamic.
My snippet:
<li>
{% assign menuExpanded = false %}
<a class="ch-wp-menu-item-link"
href="{{item.value}}"
onclick="return cityHiveMenuItemLinkClicked(event)"
onmouseover={% assign menuExpanded = true %}
onblur="{{menuExpanded = false}}"
aria-expanded="{{menuExpanded}}">
My menu item
</a>
</li>
The issue I faced is that I can't just use the <script>
tag, create a variable there, and then use it in the template itself.
What could be a solution here? Thank you!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
添加以下代码行,它对我有用。
attr.aria-expanded =“ {{menuexpanded}}”
Add the following line of code instead, it worked for me.
attr.aria-expanded="{{menuExpanded}}"