Jquery - jcarousel 中的错误
我在我开发的网站的主页上遇到了 Javascript 错误。主页上有一个 jCarousel 滚动条,可以在配置文件之间滚动。
错误如下:
this.clip[0] is undefined
在jquery.jcarousel.js的第844行。
网址是 http://www.professionalgirlfriends.co.uk - 请原谅这个主题,因为它是一个陪护网站。
知道怎么回事吗?
I'm getting a Javascript error on the homepage of a site I've developed. On the homepage there is a jCarousel scroller to scroll between profiles.
The error is as follows:
this.clip[0] is undefined
On line 844 of jquery.jcarousel.js.
And the URL is http://www.professionalgirlfriends.co.uk - Excuse the subject matter, as it's an escort website.
Any idea what's up?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(5)
顺便说一句,我遇到了同样的问题,而且我有 div 标签而不是 ul 标签:
Btw, I had the same problem, and it was I had div tags instead of ul tags:
其实我只是自己修好了。导致问题的原因如下:
在我的一个 Javascript 文件中,我有以下代码:
该代码用于在主页上加载 jcarousel。导致问题的原因是我在触发 jcarousel 时不够具体。换句话说,页面上有多个
.view-content
。我将其更改为:
现在全部排序了!
谢谢
I actually just fixed it myself. The thing that was causing the issue is as follows:
In one of my Javascript files, I have the following code:
This code is there to load the jcarousel on just the homepage. The thing that was causing the issue is I wasn't being specific enough when I was triggering the jcarousel. In other words, there was more than one
.view-content
on the page.I changed it to:
All sorted now though!
Thanks
我无法在工作中查看页面,但当找不到尺寸或无法计算裁剪平面时,通常会出现该错误。请务必使用 CSS 设置剪切平面的宽度(通常是直接围绕 ul 的 div),并将后备尺寸传递给 jcarousel 选项 (
itemFallbackDimension
)。I can't view the page at work but that error often comes up when either a dimension cannot be found, or the clipping plane cannot be calculated. Be sure to set the width on the clipping plane using CSS (it's usually the div directly surrounding the ul) and pass in a fallback dimension to your jcarousel options (
itemFallbackDimension
).我将其发布为答案,因为对于简单的评论来说有点太多了。也就是说,有两个文件 style.css 和 gallerific.js Web Inspector 识别为返回 404 标头(资源不能成立)。由于大多数与维度相关的错误(在 Chrome 中:
Uncaught TypeError: Cannot read property 'offsetWidth' of undefined
)都与无法找到维度相关,我怀疑将这些资源正确链接到页面可能会解决您遇到的问题。如果没有,请在 JS Bin 或 JS Fiddle,我们更多的人(包括我们工作的人)可能可以看看。
I'm posting this as an answer because it's a little too much for a simple comment. That said, there are two files style.css and gallerific.js that Web Inspector identifies as returning 404 headers (resource can't be found). As the majority of dimension-related errors (in Chrome:
Uncaught TypeError: Cannot read property 'offsetWidth' of undefined
) are related to being unable to find the dimension I suspect that properly linking these resources to the page will probably solve the issue you're having.If it doesn't, then please post a safe-for-work demo of your problem at JS Bin or JS Fiddle, where more of us (including those of us at work) might be able to take a look.
只需使用以下结构:
Just use this structure:
<ul id="slider">
<li><img src="x.jpg"/></li>
<li><img src="y.jpg"/></li>
<li><img src="z.jpg"/></li>
</ul>