Php 如何从动态创建的嵌套无序列表中构建下拉菜单?
我有一个无序列表,它是在嵌套无序列表的循环中动态生成的。我只想显示Php 如何从动态创建的嵌套无序列表中构建下拉菜单?,php,jquery,drop-down-menu,unordered,Php,Jquery,Drop Down Menu,Unordered,我有一个无序列表,它是在嵌套无序列表的循环中动态生成的。我只想显示嵌套列表名,然后单击时,子列表将显示 下面是创建列表的整个代码块: <ul class="faceted-menu"> <?php // Loop through faceted menus while(shopp('collection.facet-menus')) : // Skip menus with no options if ( ! shopp('collec
嵌套列表名
,然后单击时,子列表将显示
下面是创建列表的整个代码块:
<ul class="faceted-menu">
<?php
// Loop through faceted menus
while(shopp('collection.facet-menus')) :
// Skip menus with no options
if ( ! shopp('collection.facet-menu-has-options')) continue;
?>
<li>
<h4 style="color: #303030;"><?php
// current facet filter name
shopp('collection.facet-name'); ?></h4>
<ul class="facet-option" style="display:none;">
<?php
// Loop through filter options for this faceted menu
while(shopp('collection.facet-options')) : ?>
<li>
<a href="<?php
// toggle url for current filter option
esc_url(shopp('collection.facet-option-link')); ?>"><?php
// the full label of the facet filter option
shopp('collection.facet-option-label'); ?></a> (<span class="count"><?php
// the number of products sharing this facet
shopp('collection.facet-option-count'); ?></span>)
</li>
<?php endwhile; ?>
</ul>
</li>
<?php endwhile; ?>
</ul>
以及:
我愿意接受任何建议。试试这个:单击菜单li时,它将显示.facet选项
$("ul.faceted-menu li").click(function() {
$(".facet-option", this).show();
});
如果需要隐藏其他菜单,请单击
$("ul.faceted-menu li").click(function() {
$(".facet-option").hide();
$(".facet-option", this).show();
});
查德,尝试了你的答案,但没有成功。
$("ul.faceted-menu li").click(function() {
$(".facet-option", this).show();
});
$("ul.faceted-menu li").click(function() {
$(".facet-option").hide();
$(".facet-option", this).show();
});