The error says:

TypeError: $drag[0] is undefined maxY = trackHeight - $drag[0].offsetHeight; 

No one came across a case?

I initialize jScrollPane like this:


upd [1]

strange, everything seems to be normal., I connect all the necessary scripts:

 <!-- jScrollPane & MouseWheel --> <script type="text/javascript" src="plugins/jscrollpane/jquery.mousewheel.js"></script> <script type="text/javascript" src="plugins/jscrollpane/jquery.em.js"></script> <script type="text/javascript" src="plugins/jscrollpane/mwheelIntent.js"></script> <script type="text/javascript" src="plugins/jscrollpane/jquery.jscrollpane.min.js"></script> <link type="text/css" rel="stylesheet" href="plugins/jscrollpane/jquery.jscrollpane.css" media="all" /> <!-- // END jScrollPane & MouseWheel --> 

the jquery.em.js and mwheelIntent.js optional, so if I delete or comment them out, nothing changes.

In general, the initialization result:

 <div style="width: 100px; height: 100px; overflow: hidden; padding: 0px;" id="test"> lorem ipsum ... очень много lorem ipsum <div class="jspContainer" style="width: 100px; height: 100px;"> <div class="jspPane" style="padding: 0px; top: 0px; width: 100px;"></div> </div> </div> 

As you can see, a div appeared below, in which there is another div , but this is not the point, look at the picture: pic

Alas. Maybe this miracle still need some pictures to load or themes?

  • with undefined 's any scriptter encountered, but a little more code won't hurt - Specter
  • there is no other code. All the scripts that need to be connected, and all my code can fit in one line: $(document).ready(function(){ $("#test").jScrollPane(); }); - Smash

2 answers 2

Here is the latest version of the script .

You probably have an old script with some flaws. Try this and look at the result.

PS $drag no longer in the script. You seem to have a script for 2009.

UPD. Here is the script page, take the rest too from here. Everything will work;)

  • Where did you get it? Better then and everything else download. - Smash
  • Having connected your script, the error disappeared, jScrollPane is supposedly initialized, but the scrolls themselves do not appear this is the problem, although their containers appear. - Smash
  • Added link to the plugin page - iKuzko
  • see upd [1]. - Smash
  • one
    Wrap the text in your block into some element. Instead of <div style = "width: 100px; height: 100px; overflow: hidden; padding: 0px;" id = "test"> lorem ipsum ... lots of lorem ipsum </ div> Make <div style = "width: 100px; height: 100px; overflow: hidden; padding: 0px;" id = "test"> <p> lorem ipsum ... a lot of lorem ipsum </ p> </ div> - iKuzko

Yet it is written:

 $drag[0] is undefined 

The array may not be declared ...

  • Well, it has not been announced, but I have something to do with it, I did how everything in the documentation for it says and the FIG is started. - Smash
  • This error occurs in the source code of the plugin, I wonder - Specter
  • exactly in the source code. - Smash
  • there are lines currentOffset = $ drag.offset (false); // normal - = dragPosition; maxY = trackHeight - $ drag [0] .offsetHeight; // undefined try to enter console.log somewhere before calculating maxY and see what $drag[0] is - Specter
  • one
    So the jScrollPane curve, download a new one from another site - Artem