gpt4 book ai didi

javascript - 使用 moovweb 转换类别下拉列表以切换

转载 作者:可可西里 更新时间:2023-11-01 14:48:45 26 4
gpt4 key购买 nike

我想在以下代码中添加切换器:

<div class="z100" id="category-sidebar">
<h3 class="header">
<a class="header" href="/shop/us/en/#">
<span>The Latest</span>
</a>
</h3>
<ul class="show-more limit-10" style="display: block;">
<li class=" first">
<a href="/shop/us/en/mens/new-arrivals"><span>New Arrivals</span></a>
</li>
......
</ul>
<h3 class="header">
<a class="header" href="/shop/us/en/#">
<span>The Latest</span>
</a>
</h3>
<ul class="show-more limit-10" style="display: block;">
<li class=" first">
<a href="/shop/us/en/mens/new-arrivals"><span>New Arrivals</span></a>
</li>
......
</ul>
......
</div>

我试过了

$("./ul"){
attribute("data-ur-toggler-component","content")
attribute("data-ur-state","disabled")
wrap("div",data-ur-set: "toggler",data-ur-state: "disabled"){
insert_top("div",class:"cat-header",data-ur-toggler-component:"button",data-ur-state:"disabled"){
move_here("../h3/a","top") {
name("div");
attribute("href","")
}
}
}
}

但无法将切换器标题移动到正确的位置。

最佳答案

html() {
$('//div[@class="z100"]') {
attribute('data-ur-set','toggler')
attribute('style','border: 1px red so;id;')
$('//h3[@class="header"]') {
name('div')
attribute('data-ur-toggler-component','button')
}
$('//ul[@class="show-more limit-10"]') {
name('div')
attribute('data-ur-toggler-component','content')
$('.//li') {
name('div')
}
}
}
}

同样在sass文件中写入如下代码

[data-ur-toggler-component="content"] {
display: none;
&[data-ur-state="enabled"] {
display: block;
}

并从 html 中删除内联属性 display="block"引用http://tester.tritium.io/f15079e92fb4b53232bf4a94cceb1787f8012a33

关于javascript - 使用 moovweb 转换类别下拉列表以切换,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24164330/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com