jQuery可滚动文本 [英] JQuery Scrollable Text

查看:107
本文介绍了jQuery可滚动文本的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在搜索一个jQuery插件,该插件将在可滚动框中绑定文本.大多数滚动插件都在转换浏览器的滚动条,但我想保持它的原样和可用性.这只是为了在一个很小的空间中包含大量文本.

I'm searching for a jquery plugin that will bound text inside a scrollable box. Most of the scroll plugins are converting the browser scroll bar but I want to keep that as it is and usuable. This is just to contain a large amount of text in a small space.

就像这样的页面一样,它们的最底部包含一个在一个小的可滚动框中显示大量文本.我尝试实现此插件,但我对JQuery还是有点陌生​​,所以微不足道的说明不足以让我脱身.如果我可以使用此插件执行我想做的事情,那么这段代码对吗?:

It's like this page where at the very bottom they are containing a large amount of text in a small scrollable box. I tried to implement this plugin but I'm kinda new to JQuery so the meager instructions weren't enough for me to get off my feet. If I can use this plugin to do what I want, is this code right?:

<script>
$(document).ready(function(e) {
    $(".Information").uscrollbar();
});
</script>

<div id="Hotel" class="Information">
        <p>blah</p>
        <p>blah</p>
        <p>blah</p>
        <p>blah</p>
        <p>blah</p>
        <p>blah</p>
        <p>blah</p>
        <p>blah</p>
        <p>blah</p>
        <p>blah</p>
        <p>blah</p>
        <p>blah</p>
    </div>

推荐答案

您真的不需要jQuery.只是一些CSS.

You really don't need jQuery for this. Just some CSS.

.Information{
height:100px;
overflow:auto;
}

如果您确实需要此插件,请确保您正确引用了jQuery以及指向插件js文件的链接.

If you have a genuine need for this plugin then make sure you're referencing jQuery correctly and the link to the plugin js file.

如果在浏览器中运行页面,则控制台窗口中没有任何内容.任何错误.

If you run the page in your browser do you get anything in the console window. Any errors.

添加了 JSFiddle

另外,请确保您引用的是必需资产:

Also be sure you're referencing the required assets:

jquery.uscrollbar.js
jquery.uscrollbar.css

这篇关于jQuery可滚动文本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆