ネストされた順序なしリストを含むループで動的に生成される順序なしリストがあります。だけを表示したいのですが<h4> nested list name </h4>
、クリックするとサブリストが表示されます。
リストを作成するコードのブロック全体を次に示します。
<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>
以下に、私が試した 2 つの jQuery スクリプトを示しますが、いずれも機能しませんでした。
$("ul.faceted-menu li").click(function(event) {
$(this).find("ul.facet-option").removeAttr('style');
});
と:
$("ul.faceted-menu li").live('click', function() {
$(this).find("ul.facet-option").removeAttr('style');
});
私はどんな提案にもオープンです。