Malihu Custom Scrollbar with Backbone

Skip to first unread message

Patrick Caillouet

Jan 23, 2017, 5:19:34 PM1/23/17
to backbonejs
Hi everyone. I'm new to backbone but not HTML/JS/CSS.

I'm trying to get a custom scrollbar to work inside one of my views.

I found this popular library:

But I'm having a hard time using it with backbone.

The library supports 2 ways of using the scrollbar... with custom html attribute... or with javascript.

If I try to setup the scrollbar with javascript like this:


it doesn't work.. I can see it did try to do something (as I see classes added etc), but doesn't work.

But if I use the html attributes like this:

<div class="mCustomScrollbar" data-mcs-theme="dark">
  <!-- your content -->

It does work.

If I try doing this without backbone, and jquery alone, everything works fine.

here is the code for my view:

var TestView = Backbone.View.extend({
this.$el.html("<div id='scrollbar'></div>");

this.thescrollbar = this.$el.find("#scrollbar");


Is there something else I need to do to use 3rd party libraries like this with backbone?

Reply all
Reply to author
0 new messages