gpt4 book ai didi

rangeslider - Rickshaw.Graph.RangeSlider TypeError : $(element). slider 不是函数

转载 作者:行者123 更新时间:2023-12-04 16:55:37 26 4
gpt4 key购买 nike

我有这个错误:TypeError: $(element).slider 不是函数

使用以下脚本:

Rickshaw.namespace('Rickshaw.Graph.RangeSlider');

Rickshaw.Graph.RangeSlider = function(args) {

var element = this.element = args.element;
var graph = this.graph = args.graph;

$( function() {
$(element).slider( {

range: true,
min: graph.dataDomain()[0],
max: graph.dataDomain()[1],
values: [
graph.dataDomain()[0],
graph.dataDomain()[1]
],
slide: function( event, ui ) {

graph.window.xMin = ui.values[0];
graph.window.xMax = ui.values[1];
graph.update();

// if we're at an extreme, stick there
if (graph.dataDomain()[0] == ui.values[0]) {
graph.window.xMin = undefined;
}
if (graph.dataDomain()[1] == ui.values[1]) {
graph.window.xMax = undefined;
}
}
} );
} );

$(element)[0].style.width = graph.width + 'px';

graph.onUpdate( function() {

var values = $(element).slider('option', 'values');

$(element).slider('option', 'min', graph.dataDomain()[0]);
$(element).slider('option', 'max', graph.dataDomain()[1]);

if (graph.window.xMin == undefined) {
values[0] = graph.dataDomain()[0];
}
if (graph.window.xMax == undefined) {
values[1] = graph.dataDomain()[1];
}

$(element).slider('option', 'values', values);

} );
};

来自以下页面: https://github.com/shutterstock/rickshaw/blob/master/src/js/Rickshaw.Graph.RangeSlider.js

javascript 调试器向我显示这一行:幻灯片:function( event, ui ) {

你能告诉我解决问题的方法吗?感谢您!

最佳答案

您应该在使用 slider 之前导入 jqueryui。

http://jqueryui.com/slider/

关于rangeslider - Rickshaw.Graph.RangeSlider TypeError : $(element). slider 不是函数,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13645833/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com