You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Foundation 6.4.3 Off-Canvas容器失效问题求助

Fixing Your Foundation 6 Off-Canvas Menu Issue

Hey there! The main reason your Off-Canvas menu isn't showing up is that you're missing the trigger button needed to toggle it open. Foundation's Off-Canvas component is hidden by default—you need a button (or any interactive element) with the right data attribute to make it appear.

Let's walk through the fix step by step:

Step 1: Add the Toggle Button

Inside your off-canvas-content container, add a button with the data-toggle attribute set to match your Off-Canvas container's ID (offCanvas). Here's how to update that section of your code:

<div class="off-canvas-content" data-off-canvas-content>
  <!-- Trigger button for Off-Canvas menu -->
  <button type="button" class="button" data-toggle="offCanvas">Open Menu</button>
  <!-- Your page content lives here -->
  Welcome !
</div>

Step 2: Confirm Your Existing Setup is Correct

Good news—most of your code is already right:

  • You've used the proper Off-Canvas wrapper structure (off-canvas-wrapper → off-canvas + off-canvas-content)
  • All required data attributes are in place (data-off-canvas, data-off-canvas-content, data-close on the menu's close button)
  • Foundation JS initialization ($(document).foundation();) is correctly placed after loading the Foundation script file.

Optional: Set Default Open State (If Needed)

If you want the menu to be visible as soon as the page loads, add the is-open class to your Off-Canvas container:

<div class="off-canvas position-left is-open" id="offCanvas" data-off-canvas>

Once you add the trigger button, clicking it should slide out your menu exactly as expected.

内容的提问来源于stack exchange,提问作者belgoros

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.05.15 03:25:44