让Foundation 4 JS在WP中工作的问题 [英] Problems getting Foundation 4 JS to work in WP

查看:79
本文介绍了让Foundation 4 JS在WP中工作的问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在将基金会4 Bones 创建一个WP Starter主题。我使用基金会3的JS工作得很好,但现在我正在尝试实施Foundation 4 JS,我遇到了一些问题。

I'm merging Foundation 4 with Bones to create a WP Starter theme. I had everything working fine with the JS from Foundation 3, but now that I'm trying to implement the Foundation 4 JS I'm running into some issues.

我跟着 Foundation 4 JS文档中的步骤,但仍然没有运气。这是我在关闭body标签之前直接放置的代码(我知道正确的方法是将脚本排入队列,但是对于测试我只是将它直接粘贴在关闭的body标签上方):

I followed the steps found in the Foundation 4 JS Documentation, but still had no luck. Here is the code I placed directly before the closing body tag (I know the correct way is to enqueue the script, but for testing I was just pasting it directly above the closing body tag):

<script>
document.write('<script src=http://mcfaddengavender.net/jeremy/wp-content/themes/bones-master/library/js/vendor/'
+ ('__proto__' in {} ? 'zepto' : 'jquery')
+ '.js><\/script>');
</script>   

<script src="http://mcfaddengavender.net/jeremy/wp-content/themes/bones-master/library/js/foundation.min.js"></script>

<script>
$(document).foundation();
</script>    

我正试图在此页,但正如您所看到的,单击链接时模式永远不会触发。我注意到Javascript控制台中有一些错误,但我还是JS的新手,所以他们有点过头了。

I'm attempting to open a modal on this page, but as you can see, the modal never fires when you click the link. I notice some errors in the Javascript console, but I'm still new to JS so they are a bit over my head.

正如我之前提到的,事情进展顺利使用Foundation 3 JS,它不需要调用来初始化函数 - 它似乎只是工作。不确定这是否会产生巨大的影响,但我注意到,与Foundation 3 JS相比,Foundation 4 JS的文档有所不同。

As I mentioned before, things were working fine with the Foundation 3 JS, which didn't require the call to initialize the function - it just seemed to work. Not sure if that makes a huge difference, but it's something I noticed that was different about the documentation for Foundation 4 JS compared to Foundation 3 JS.

任何人都可以指点我在正确的方向?

Can anyone get me pointed in the right direction?

推荐答案

看起来浏览器找不到Zepto(至少chrome不能)。

It looks like the browser can't find Zepto (at least chrome can't).

它在这里寻找:
http://mcfaddengavender.net/library/js/vendor/zepto.js 但它返回404

It's looking for it here: http://mcfaddengavender.net/library/js/vendor/zepto.js but it returns a 404

确保你的图书馆设置在适当的目录中!

Make sure you have your libraries set up in the appropriate directories!

这篇关于让Foundation 4 JS在WP中工作的问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆