0

我正在使用 jQuery Steps,我想处理一个名为: 的事件onStepChanging

默认值为function (event, currentIndex, newIndex) { return true; }

我尝试了以下方法,但没有运气:

$("#wizard").onStepChanging(function (event, currentIndex, newIndex){
    Console.log("onStepChanging");
});

我可以帮忙吗?

提前致谢

4

4 回答 4

1

您应该对 console.log() 使用小写的“c”。

于 2014-01-28T00:24:45.263 回答
1

这是答案,它需要一些尝试,但这有效:

$("#wizard").steps({
    headerTag: "h2",
    bodyTag: "section",
    transitionEffect: "slideLeft",
    stepsOrientation: "vertical",
    onStepChanging: function (event, currentIndex, newIndex){
        //alert("stepchanging event");
        return true;
    }
});
于 2014-01-28T01:52:30.540 回答
0

“控制台”中的“C”应为小写。对于这样的事情,一个好的调试方法是尝试不同的输出,比如alert("This is working");判断问题是事件处理程序还是输出。

于 2014-01-28T00:27:56.060 回答
0

你可以试试这个:

$("#wizard").on("stepchanging", function (event, currentIndex, newIndex){
    console.log("onStepChanging");
});

只需检查第一个参数的大小写。我不确定我写的方式是否完全适合。

$().on 触发一个函数,然后触发某个事件。

另外,theconsole是小写的。

于 2014-01-28T00:28:26.137 回答