1

所以我正在使用手风琴风格的菜单(我想这是正确的术语)。我认为这里的独特困难在于我正在使用 Lemonstand 的集成 CMS 系统,这是一种祝福和噩梦。我不确定有多少人会熟悉lemonstand 的 API 等等,但我想我会先在这里发帖寻求帮助。

我想要做的是在点击后保持“下拉”打开。使用的JS如下:

 <script>
function initMenu() {
  $('#menu ul').hide(); // Hide the submenu
  if ($('#menu li').has('ul')) $('#menu ul').prev().addClass('expandable'); // Expand/collapse a submenu when it exists  
  $('.expandable').click(function(e) { // Prevent Default
        e.preventDefault(); 
        $(this).next().slideToggle();
        $(this).toggleClass('expanded');
      }
    );
  }

// When document ready, call initMenu() function 
$(document).ready(function() {initMenu();}); </script>

我敢肯定这很容易,但就 js 而言,我对整个事情还是很陌生。

<? $category_listing = isset($parent) ? $parent->list_children('front_end_sort_order') : Shop_Category::create()->list_root_children('front_end_sort_order'); ?>
<? if ($category_listing->count()): ?>
<? if (!isset($parent)): ?>

<nav>
<ul id="menu">
<? else: ?>
<ul>
<? endif ?>

<? foreach ($category_listing as $_category): ?>

<li<?= (isset($category) && $category->id == $_category->id) ? ' class="current"' : '' ?>>
<a href="<?= $_category->page_url('bifrost-sandbox/category') ?>"><?= h($_category->name) ?></a>
<? $this->render_partial('sandbox:temp', array('parent' => $_category)) ?>
</li>
<? endforeach ?>
</ul>
<? if (!isset($parent)): ?>
<nav>

<? endif ?>
<? endif ?>

如果有人可以帮助我,我将不胜感激。

4

0 回答 0