1

This question is related to the answer of adding jquery plugin to Zurb's Foundation Framework, but it's missing how to implement it to app.js

I use to maintain layout. I also use jQuery cookie plugin. After adding Foundation JavaScript as described under HTML Page Markup in this document, I noticed that the jQuery cookie plugin does not work. I get this error message in console:

Uncaught TypeError: Object function (e,t){return new y.fn.init(e,t,n)} has no method 'cookie' 8:184
(anonymous function) 8:184
o jquery.min.js:2
p.fireWith jquery.min.js:2
e.extend.ready jquery.min.js:2
c.addEventListener.B jquery.min.js:2

Is there any way to include the jQuery cookie plugin in app.js of Foundation? Or is there any other solution?!

4

2 回答 2

1

I really do not know about "zurb-foundation" but I just want to show you another way of using cookies without $.cookie plugin

如果不担心IE7以下,可以使用HTML5的Local Storage。

欲了解更多信息:HTML5-存储

于 2013-03-31T02:34:25.250 回答
0

最后我找到了解决方案。这只是 javascripts 文件顺序链接的问题。换句话说,我必须在链接到foundation.min.js 和app.js 之后链接到Jquery.cookie,而不是在它们之前。所以 Javascript 链接的最终顺序应该是:

'jquery','modernizr.foundation','foundation.min','app','jquery.cookie','jquery-ui-1.8.22.custom.min'。

于 2013-03-31T12:14:34.813 回答