JQuery Scrollable Text

前端 未结 3 1852
旧巷少年郎
旧巷少年郎 2021-01-28 09:47

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 i

3条回答
  •  谎友^
    谎友^ (楼主)
    2021-01-28 09:56

    If you need to dynamically do this to elements, just wrap the content in a

    with a special class:

    CSS:

    .scroll {
        overflow: auto;
        max-height: 100px;
    }
    

    JS:

    $(document).ready(function() {
        $('.elements_that_should_scroll').wrap($('
    ', {'class': 'scroll'})); });

    Demo: http://jsfiddle.net/nW7uH/

    If not, just give those elements the class scroll and it should work just fine without JS.

提交回复
热议问题