Using jqrangeslider with dart js-interop does not

2019-08-30 23:41发布

问题:

I am trying to use the jqrangeslider ( http://ghusse.github.io/jQRangeSlider/index.html ) in my web_ui app and it is not working.

In my application main root dart file I have:

void main() {

js.scoped((){
  js.context.jQuery("#slider").bind("valuesChanged", new js.Callback.many((e, data) {
    fromRange = data.values.min;
    toRange = data.values.max;
  }));
});

main root html file I have:

  <script src="jquery.min.js"></script>
  <script src="jquery-ui.custom.min.js"></script>
  <script src="jQRangeSlider-min.js"></script>
  <script src="../packages/browser/dart.js"></script>
  <script src="../packages/browser/interop.js"></script>

In the custom components html file I have:

<div id="slider"></div>

<script>
    $("#slider").rangeSlider();
  </script>

The slider simply does not appear at all.

Any help appreciated. Thanks.