开发者

jScrollPane/jQuery - newbie question

开发者 https://www.devze.com 2023-03-09 03:58 出处:网络
I\'m going through jQuery Novice to Ninjan book containing an exercise illustrating how to add a simple jScrollPane plugin.

I'm going through jQuery Novice to Ninjan book containing an exercise illustrating how to add a simple jScrollPane plugin. The problem is that when I change the libraries to the latest ones out there it stops working and I can't seem to put my finger on what the mistake is and is bugging me that I can't figure this out.

The old code (which works) that I have is as follows :

    $(document).ready(function(){
  $('#fine_print').jScrollPane({
    scrollbarWidth: 10,
    scrollbarMargin: 10,
    showArrows: false
  });
});

The old external resources that I am linking are as follows :

    <link rel="stylesheet" href="jScrollPane.css" type="text/css" media="screen" charset="utf-8" />

  <script src="../../lib/jquery-1.4.min.js" type="text/javascript" charset="utf-8"></script>
  <script type="text/javascript" src="jScrollPane.js"></script>
  <script type="text/javascript" src="jquery.mousewheel.js"></script>

The new external resources (and jScrollPane disappears) that I am linking are as follows :

    <!-- styles needed by jScrollPane -->
<link type="text/css" href="new/jquery.jscrollpane.css" rel="stylesheet" media="all" />

<script src="../../lib/jquery-1.5.1.min.js" type="text/javascript" charset="utf-8"></script>



<!-- the mousewheel plugin - optional to provide mousewheel support -->
<script type="text/javascript" src="new/jquery.mousewheel.js"></script>

<!-- the jScrollPane script -->
<script type="text/javascript" src="new/jquery.jscrollpane.min.js"></script>

The author replied back to me saying that the arguments given to jScrollPane are different in the new version

One of the samples provided on jScrollPane site is as follows :

    $(function()
{
    $('.scroll-pane').jScrollPane(
        {
            verticalDragMinHeight: 20,
            verticalDragMaxHeight: 20,
            horizontalDragMinWidth: 20,
            horizontalDragMaxWidth: 20
        }
    );
});

But i tried looking at the examples and I guess due to my lack of experience cannot figure out whether I am not integrating the examples correctly 开发者_Go百科into the $(document).ready action or I have the libraries linked in the wrong order or something else.

If anyone could kindly assist me with this would be grateful - thanking in advance.


switch back to jquery version 1.4 and initialize the jscrollpane as

$(document).ready(function(){
  $('#fine_print').jScrollPane();
});

It should work - infact it will!

Also in-case you can show us the page you are using it on - would be great!

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号