問題描述
我正在尋找一個將文本綁定到可滾動框內的 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 可滾動文本的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!