javascriptjquerycssangularjsslimscroll

Slimscroll does not work in an ui-view with AngularJs


I want to use SlimScroll in my project. The problem is that the content that needs to scoll is in a ui-view.

Here is the markup:

<div class="col-lg-6" id="conversation-content">
    <div id="scroll">
        <div ui-view="conversation-content"></div>
    </div>
</div>

I don't know what the problem is. The #scroll div gets a height and width but it does not scroll and the SlimScroll bar is not visible.

This is the SlimScroll JS:

$(function(){
    $("#scroll").slimScroll({
        height: "auto",
        color: "#00f",
        size: "10px",
        alwaysVisible: true
    });
});

Any help would be appreciated.


Solution

  • Without more detail, I can only advise adding these Script blocks in this order:

    <script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.9.0/jquery.min.js"></script>
    <script type="text/javascript" src="jquery.slimscroll.js"></script>
    <script type="text/javascript">
    $(function ()
    {
        $("#scroll").slimScroll({
            height: "auto",
            color: "#00f",
            size: "10px",
            alwaysVisible: true
        });
    });
    </script>
    

    This requires the jquery.slimscroll.js to be in the same folder/directory as this HTML or web page. Swap the jquery.slimscroll.js for jquery.slimscroll.min.js if you are using the minified version.