jQuery jScrollPane - 它根本不起作用! :'(

发布于 2024-09-01 13:04:39 字数 1480 浏览 8 评论 0原文

好吧 - 我承认,我是这个 jQuery 部门的初学者。我可能犯了一些业余错误,但是嘿,你必须在某个地方学习! :)

所以我使用 jScrollPane: http://www.kelvinluck.com /assets/jquery/jScrollPane/jScrollPane.html

我想使用它来设置第二列中的可滚动区域的样式。具体来说,我想在 div #ajaxresults 上应用滚动条并设置其格式。

我的页面...相当 jQuery 重。我不知道是否有任何变量发生冲突或其他什么......事实上我真的不知道为什么这不起作用。

看看我有问题的页面: http://furnace.howcode.com

在标题中,我将其设置为:(

    <!-- Includes for jScrollPane --> 
<script type="text/javascript" src="http://localhost:8888/js/jquery.mousewheel.min.js"></script> 
<script type="text/javascript" src="http://localhost:8888/js/jScrollPane.js"></script> 
<link rel="stylesheet" type="text/css" media="all" href="http://localhost:8888/stylesheets/jScrollPane.css" /> 
<script type="text/javascript"> 
$(function() {
    $('#ajaxresults').jScrollPane();
});
</script> 

尽管我已经更改了服务器副本上的 localhost)

#ajaxresults div 似乎没有任何效果。正如 jScrollPane 文档所说,我已经设置了 overflow:auto 但仍然没有运气。我发现当 jScrollPane 看起来确实“运行”时,它只是将 div 向下移动大约 100 像素。亲自尝试一下。

也许有人可以帮忙?那里有相当多的 jQuery 插件,所以我不知道是否有东西发生碰撞/崩溃等...

请注意,该网站仍在我和朋友之间开发中,这解释了我们互相提交的个人消息(“嗨,唐尼”) !'等:D)。另外,当您查看页面时,第二列中可能有几秒钟不会出现任何内容 - 它只是通过 Ajax 获取数据。所以给它一点时间。

非常感谢!

杰克

OK - I'll admit, I'm quite a beginner in this jQuery-department. I've probably made some amateur mistake, but hey, you gotta learn somewhere! :)

So I'm using jScrollPane: http://www.kelvinluck.com/assets/jquery/jScrollPane/jScrollPane.html

I want to use it style the scrollable area in my second column. Specifically, I would like to apply and format the scrollbars on the div #ajaxresults

My page is... rather jQuery heavy. I don't know if any variables are conflicting or something... in fact I really have no idea at all why this isn't working.

Take a look at my problematic page: http://furnace.howcode.com

In the header, I've set this to go:

    <!-- Includes for jScrollPane --> 
<script type="text/javascript" src="http://localhost:8888/js/jquery.mousewheel.min.js"></script> 
<script type="text/javascript" src="http://localhost:8888/js/jScrollPane.js"></script> 
<link rel="stylesheet" type="text/css" media="all" href="http://localhost:8888/stylesheets/jScrollPane.css" /> 
<script type="text/javascript"> 
$(function() {
    $('#ajaxresults').jScrollPane();
});
</script> 

(I've changed localhost on the server copy though)

Nothing ever seems to work with the #ajaxresults div. I've set, as the jScrollPane docs say, overflow:auto on it but still no luck. I find that when jScrollPane DOES seem to 'run' it just moves the div down about 100 pixels. Try it for yourself.

Perhaps someone could help? There's quite a few jQuery plugins there so I don't know if something's colliding/crashing etc...

Please note the site is still in development between myself and a friend, which explains the personal messages we submit to each other ('Hi Donnie!' etc. :D ). Also, when you view the page nothing may appear in the second column for a few seconds - it's just fetching the data via Ajax. So give it a little time.

Thanks very much!

Jack

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

看轻我的陪伴 2024-09-08 13:04:39

查看您的代码后,让我印象深刻的第一件事是您将 JS 代码放置在“ajaxresults”div 中。一般来说,最好将代码保留在目标 div 之外。像这样放置空 div:

<div id="ajaxresults" class="scroll-pane"></div>

在底部并使用 jQuery 填充类似 .append().html()。有很多选择。我确信我可以编织更多的东西,但这似乎是我建议的第一个重大改变。

这可能是一个过程。

另外,如果您还没有 Firebug,我可能建议您获取一份副本。它对于 jQuery 调试确实很有帮助。

After viewing your code, the first thing that strikes me is that you've placed JS code inside the "ajaxresults" div. Generally it's best to keep your code outside the target div. Place the empty div like so:

<div id="ajaxresults" class="scroll-pane"></div>

At the bottom and use jQuery to populate with something like .append() or .html(). There are lots of options. I'm sure there are more things I could knit pick but this seems to be first major change I'd suggest.

This might be a bit of a process.

Also, if you don't already have Firebug, I might suggest getting a copy. It can really be helpful in jQuery debugging.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文