mardi 1 septembre 2015

Malihu scrollbar does not work with partial view

I have to create partial view with scroll bars, but not default browser scrolls. I've found Malihu scrollbars, that works perfrectly. But when I tried to use it with partial view nothing happens.

Here is samples of working code:

_Layout.cshtml:

<div id="treeview" class="col-md-2 treeview" style="padding-left: 0 !important; height: 520px">
    @if (categories != null && categories.Any())
    {
        <ul id='categoriesList'>
            @TreeView.GetTreeView(categories, categories.FirstOrDefault().ParentId)
        </ul>
    }
</div>
<div id="viewPartial" class="col-md-8" style="padding-left: 0 !important; height: 520px">
    <!--Partial view-->
    @RenderBody()
</div>

<div id="filters" class="col-md-2 treeview">
    TODO FILTERS
</div>
/*Some stuff*/
<script>
(function($) {
    $(window).load(function() {
        $("#treeview").mCustomScrollbar({
            theme: "dark",
            scrollInertia: 100
        });
    });
})(jQuery);

My partial view:

/*Some tags above*/
<script>
(function ($) {
    $(window).load(function () {
        $("#treeview").mCustomScrollbar({
            theme: "dark",
            scrollInertia: 100
        });
    });
})(jQuery);




Aucun commentaire:

Enregistrer un commentaire