5

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?

Probocop
  • 10,346
  • 28
  • 85
  • 115
  • 2
    May I suggest posting a demo reproducing the problem at [JS Bin](http://jsbin.com/) or [JS Fiddle](http://jsfiddle.net/), preferably with safe-for-work images? – David Thomas Nov 17 '10 at 21:44
  • wish I could help but this isn't a work-friendly page :) on a side-note, I am viewing the page just fine in chrome, and superficially, the carousel seems to be working just fine. – Dutchie432 Nov 17 '10 at 21:44
  • Thanks for your responses, and sorry about the subject matter! The actual carousel works fine, but the JS error on the page is breaking some simple jQuery I'm trying to use. – Probocop Nov 17 '10 at 21:53
  • Just a quick note, if you open this page in chrome and press Ctrl-Shift-J, you will see there are many items (some JS files too) that aren't being loaded properly. – Dutchie432 Nov 17 '10 at 22:09

5 Answers5

7

Btw, I had the same problem, and it was I had div tags instead of ul tags:

Luis R.
  • 826
  • 9
  • 13
4

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:

// Load jCarousel on homepage only
    if($('#home').length) {
        jQuery('.view-content').jcarousel();
    }

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:

// Load jCarousel on homepage only
    if($('#home').length) {
        jQuery('#block-views-escorts-block_1 .view-content').jcarousel();
    }

All sorted now though!

Thanks

Probocop
  • 10,346
  • 28
  • 85
  • 115
1

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).

Anthony Corbelli
  • 877
  • 4
  • 10
0

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>

0

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.

David Thomas
  • 249,100
  • 51
  • 377
  • 410