Acu*_*ubi 0 jquery jquery-ui jquery-plugins
---原始代码----
$(function () {
var options = {
xaxis: { mode: "time", tickLength: 5 },
selection: { mode: "x" },
crosshair: { mode: "x" }
};
});
Run Code Online (Sandbox Code Playgroud)
当rlt = true时,我想要十字准线:{mode:"x"}在选项变量中.
以下是我的代码,但它不正确.是否有人可以指出错误?
谢谢!
$(function () {
var rlt = true;
var options;
if(rlt){
options = {
xaxis: { mode: "time", tickLength: 5 },
selection: { mode: "x" },
crosshair: { mode: "x" }
};
}else{
options = {
xaxis: { mode: "time", tickLength: 5 },
selection: { mode: "x" }
};
}
});
Run Code Online (Sandbox Code Playgroud)
适合我,但你可以这样写:
var rlt = true;
var options = {
xaxis: { mode: "time", tickLength: 5 },
selection: { mode: "x" }
};
if (rlt) options.crosshair = { mode: "x" }
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
196 次 |
| 最近记录: |