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'
.
Calling Jquery function in DART lang
-
11-07-2023 - |
Question
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.
Solution
OTHER TIPS
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!
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow