开发者

JScrollPane doesn't come up on first page load

I'm using a JScrollPane on a login page, basically after successfull login, it'll go to the second page where I should see the ScrollBar but the scrollbar dosn't show on first load, I have to refresh the page one more time, does anyone know why this happens? Has anyone used JScrollPane before?

Thanks for your help.

$(function()
    {
    // this initialises the demo scollpanes on the page.
      $('#logos').jScrollPane();                
    });

<head>
    <link rel="stylesheet" type="text/css" href="css/jScrollPane.css" />

    <script type="text/javascript" src="jquery/jquery-1.3.2.js"></script>
    <script type="text/javascript" src="jquery/scrollPane.js"></script>
    <script type="text/javascript" src="jquery/jScrollPane.js"></script>
</head>

<body>

     <div id="logos" class="scroll-pane">
     <a id="logo1" href=""><img src="" /></a>
     <a id="logo2" href=""><img src="" /></a>
                 .....
                 ......

</div>

</body>

Also I don't see any errors when using firebug.

after looking around the code I realize that I need to re-initialize the scroll-pane,

so after adding the following code still the scroll bar doesn't appear on first page load but as soon as I move the cursor it appears, so I was wondering how I can reinitialize it without the hover effect,

$(function() {
reinitialiseScrollPane = function()
                {
                    $('#logos').jScrollPane();
                }
                $('body').hover(function() {
                    reinitialiseScrollPane();
                });

});  

thanks开发者_JAVA技巧 for your help.


Just for future refrence, the problem was that when there are images the scroll Pane needs to be reinitialized, so the following code would solve the problem

$('#logos').jScrollPane({reinitialiseOnImageLoad: true});


If you're looking to refresh the page automatically as a fix, then I would advise against it, as seems suspiciously like a bodge ;-)

Some code would be useful. Are you instantiating it within the documentready event? What browsers are you using? Are you getting any errors?

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜