1

设置 malihu-custom-scrollbar-plugin 时遇到问题。

我安装它如下:

jspm install mCustomScrollbar=npm:malihu-custom-scrollbar-plugin

我将它导入到相关的视图模型中,如下所示:

import mCustomScrollbar from 'mCustomScrollbar';
...
$('.article').mCustomScrollbar();

我收到以下错误:

$(...).mCustomScrollbar 不是函数

查看开发工具:网络,库已加载?

4

2 回答 2

0

你有两个问题:

1)你拼错了 mCustomScrollbar(在 Scroll 中缺少 r)
2)你需要模板中的 css 否则插件无法加载

(您的 CSS 位置可能不同)

<link rel="stylesheet" href="../jspm_packages/npm/malihu-custom-scrollbar-plugin@3.0.9/jquery.mCustomScrollbar.css" />
<template>
...
</template>
于 2015-08-13T02:53:50.033 回答
0

检查脚本文件是否加载...
$.getScript( "/jquery.mCustomScrollbar.js" ) .done(function( script, textStatus ) { console.log( textStatus ); DataBind(); }) .fail(function( jqxhr, settings, exception ) { $( "div.log" ).text( "Triggered ajaxError handler." ); });

于 2016-07-25T11:09:29.157 回答