0

I'm trying to convert the following jquery script in DART :

<script>
    (function($){
        $(window).load(function(){
            $(".content").mCustomScrollbar();
        });
    })(jQuery);
</script>

I've wrote the following code in DART :

  js.context
  .callMethod(r'$', ['.content"'])
  .callMethod('mCustomScrollbar');

But it's not working. Any help is appreciated.

3
  • Please add some description of your error. "it's not working" tells us nothing, and it's difficult to answer this as-is. Commented Apr 28, 2014 at 22:10
  • In fact , I don't have a specific error. I'm trying to use the jquery custom scroller. manos.malihu.gr/jquery-custom-content-scroller , and it seems to do not call the mcustomscrollbar function. So I think that my dart code is poorly written Commented Apr 28, 2014 at 22:33
  • 1
    Is the wrong quote a copy/past error? .callMethod(r'$', ['.content*"*']) Commented Apr 29, 2014 at 4:27

2 Answers 2

2

Aside the typo in ['.content"'] (instead of ['.content']) it looks good to me if you are using import dart:js; and not import 'package:js/js.dart'.

Sign up to request clarification or add additional context in comments.

Comments

0

The wrong quote is just a copy/past error. The code in DART is correct when using import dart.js

In fact , to use the jQuery custom content scroller plugin http://manos.malihu.gr/jquery-custom-content-scroller/ , I have to include the following script :

<!-- Google CDN jQuery with fallback to local -->
<script>!window.jQuery && document.write(unescape('%3Cscript src="js/minified/jquery-1.11.0.min.js"%3E%3C/script%3E'))</script>

I forgot to do it. so everything is Ok right now. Thank You guys!

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.