我正在使用 Vocino 的 Foundation w/Middleman 设置构建一个站点,但在使下拉链接正常工作时遇到了问题。
这是我的 layout.haml:
html.no-js
%head
%meta{:charset => "utf-8"}
%meta{:content => "IE=edge,chrome=1", "http-equiv" => "X-UA-Compatible"}
%meta{:content => "width=device-width", :name => "viewport"}
%title= data.page.title || "ZURB Foundation"
/ Included CSS Files
= stylesheet_link_tag "app"
= javascript_include_tag 'http://ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js'
= javascript_include_tag "vendor/custom.modernizr.js"
%body{:class => page_classes}
%header
= partial 'nav_bar'
%section{:role => "main", :class => "main"}= yield
%footer
-# Application Javascript, safe to override
= javascript_include_tag "app"
-# Google Analytics
= javascript_include_tag "google_analytics"
我的 _nav_bar.html.haml 简而言之:
%nav.top-bar
%ul.title-area
/ Title Area
%li.name
%h1
%a{href: "#"}
Top Bar Title
%li.toggle-topbar.menu-icon
%a{href: "#"}
span menu
%section.top-bar-section
/ Right Nav Section
%ul.right
%li.divider
%li.has-dropdown
%a{href: "#"} Main Item 1
.......
我的 app.js.coffee 的开始:
#= require "vendor/jquery"
# Foundation Javascript
= require "foundation/foundation"
(($, window, undefined_) ->
"use strict"
$doc = $(document)
Modernizr = window.Modernizr
$(document).ready ->
$(document).foundation()
........
从视觉角度来看,一切看起来都很好。但是悬停时下拉菜单不起作用。在构建时,自从我取消注释该行以来,我也收到了 app.js.coffee 的错误=require foundation/foundation
。我一直在摆弄半天,并阅读其他帖子并没有找到解决方法。在这个新环境中我只是缺少一些非常简单的东西。