Jquery jscrollpane plugin error
I get this error when I try and implement jSrollpane in Safari 4:
TypeError: Result of expression '$drag[0]' [undefined] is not an object.
Then i get this error when i try the same thing in Chrome:
Uncaught TypeError: Cannot read property 'offset开发者_Go百科Height' of undefined
But why? it works fine in FF.
Any ideas?
It appears that jQuery does not manage to resolve the child selector (“parent > child”), thus both "$track" and "$drag" are set to undefined values:
$track = $('>.jScrollPaneTrack', $container);
$drag = $('>.jScrollPaneTrack .jScrollPaneDrag', $container);
As a result, the scrollbar does not initialize, and simply does nothing Replacing the previous lines with a "dumbed down" version fixes the issue:
$track = $container.children(".jScrollPaneTrack");
$drag = $track.children(".jScrollPaneDrag");
精彩评论