Martijn
Martijn

Reputation: 93

'Is not a function' error in jquery script

I am working on a demo with a jquery carousel script and jScrollpane scrollbars with anchors links but I can't seem to get it working properly. Can someone point out what I am missing here in the script?

Via firebug I got the error messages:

"Resuming debugger: error during debugging loop: TypeError: firstViewRangeElement is null"

$(".scroll-pane-arrows").jScrollPane is not a function

$('.scroll-pane-arrows').jScrollPane(my_jscrollpane_opts); from: jquery.contentcarousel.js (line 272)

syntax error

} from: index.html (line 525)

Upvotes: 0

Views: 5877

Answers (3)

musecom.net
musecom.net

Reputation: 1

Check out the jquery version.

$ (Selector). Live (events, data, handler); / / jQuery 1.3 + 
$ (Document). Delegate (selector, events, data, handler); / / jQuery 1.4.3 + 
$ (Document). On (events, selector, data, handler); / / jQuery 1.7 + 

=> $ El.find ('a.ca-more'). Live ('click.contentcarousel', function (event) {
change $ (Document). On ('click', 'a.ca-more', function (event) {

=> $ el.find ('a.ca-close'). live ('click.contentcarousel', function (event) {
change $ (Document). On ('click', 'a.ca-close', function (event) {

Upvotes: 0

pkachhia
pkachhia

Reputation: 1932

also remove the comma (,) from below line (line no 524)

$('.scroll-pane').jScrollPane();
{
  hijackInternalLinks: true //remove comma from here
}

it will solve your error

syntax error
} from: index.html (line 525)

Upvotes: 0

Andreas Wong
Andreas Wong

Reputation: 60516

You are calling jScrollPane before you actually include its definition. If you view source in chrome

view-source:http://members.chello.nl/j.bemmel2/carousel_/

and look at line 512 - 518, you have:

<script type="text/javascript" src="js/jquery.contentcarousel.js"></script>
<script type="text/javascript">
    $('#ca-container').contentcarousel();
</script>
<!-- the Scrollbar script -->
<script type="text/javascript" src="js/jquery.jscrollpane.min.js"></script>

You are calling .contentcarousel() which calls jScrollPane, but without first including jscrollpane.min.js

What you should do is to have

<script type="text/javascript" src="js/jquery.jscrollpane.min.js"></script>

prior to calling .contentcarousel(), as the following:

<script type="text/javascript" src="js/jquery.contentcarousel.js"></script>
<!-- the Scrollbar script -->
<script type="text/javascript" src="js/jquery.jscrollpane.min.js"></script>
<script type="text/javascript">
    $('#ca-container').contentcarousel();
</script>

Upvotes: 2

Related Questions