0

I am using a plugin called slim scroll for some scroll bars on my page, my only issue with them is that they are not responsive. So while the 100px height looks nice when stretched out, it doesn't look so wonderful when the browser size is reduced.

So to solve this issue I was trying to do some jQuery to do some widowWidth and then change the data element controlling the height.

So I have tried something like this, but it seems to be just changing the actual height element instead of the data-height

function slimScrollResize(){
    loadWidth = $(window).width();
    if(loadWidth <= 1138){
        $('.slim-scroll').data('height', '300');
    }
}

So then I tried changing

$('.slim-scroll').data('height', '300');

to

$('.slim-scroll').data('data-height', '300');

and now it's not changing anything.

Is there something I'm missing? Any help would be awesome!

A js fiddle to help debug...and note I cannot change the data name because of the plugin. http://jsfiddle.net/575VZ/1/

zazvorniki
  • 3,512
  • 21
  • 74
  • 122

1 Answers1

3

You can use attr()

$('.slim-scroll').attr('data-height', '300');
Felix
  • 37,892
  • 8
  • 43
  • 55