如何将javascript滚动条附加到textarea?

Bea*_*ohn 5 javascript css jquery scroll

我有一个javascript滚动条,取代了正常的webkit/mozilla滚动条.只需键入div名称".element",它就可以在我所有的其他div上工作但是我不确定如何让滚动条应用于文本区域?有谁知道我会怎么做,会感谢任何人帮助谢谢.

JAVASCRIPT:

<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.7/jquery.min.js"></script>
<script src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8/jquery-ui.min.js"></script>
<script src="assets/js/scroll/jquery.mousewheel.min.js"></script>
<script src="assets/js/scroll/jquery.mCustomScrollbar.js"></script>

<script>
    (function($){
        $(window).load(function(){
            $(".bio textarea").mCustomScrollbar();
        });
    })(jQuery);
</script>
Run Code Online (Sandbox Code Playgroud)

HTML:

<form action="includes/changebio.php" method="post" id="form1">         
 <textarea id="bio" style="width: 442px; 
    margin-top:3px;
    text-align:left;
    margin-left:-2px;
    height: 120px;
    resize: none; 
  outline:none;
    border: hidden;" textarea name="bio" data-id="bio" maxlength="710"><?php echo stripslashes($profile['bio']); ?></textarea>
<input type="image" src="assets/img/icons/save-edit.png"class="bio-submit" name="submit" value="submit" id="submit"/>
</form>
Run Code Online (Sandbox Code Playgroud)

Mic*_*der 1

该脚本将帮助您设计文本区域的样式;http://studio.radube.com/html-textarea-custom-scrollbar。可以使用您自己的图像和 CSS 对其进行自定义。

另请查看这个 jQuery 插件:

http://www.kelvinluck.com/assets/jquery/jScrollPane/jScrollPane.html