jQuery 向后分支按钮

发布于 2024-11-18 05:10:29 字数 1294 浏览 1 评论 0原文

我正在此网站上使用内置的 jQuery 向导: http://kflorence.github.com/ jquery-wizard/examples/ 而我正在使用的是“分支向导”。根据您的选择,您将看到不同的问题/答案。

我的问题是,到目前为止,我构建了大约 4 个问题的向导,但是当您点击“向后”按钮时,您只能返回一次。我希望能够继续单击“向后”按钮来浏览我之前遇到的所有问题。

我猜这是我需要编辑的代码部分?我只是想不通:

select: function( event, step, branch, relative, history ) {

    // args: step, branch, relative, history
    if ( !( event instanceof $.Event ) ) {
        history = relative;
        relative = branch;
        branch = step;
        step = event;
        event = undefined;
    }

    if ( step == undefined ) {
        return;
    }

    // args: [ step, branch ], relative, history
    if ( $.isArray( step ) ) {
        history = relative;
        relative = branch;
        branch = step[ 1 ];
        step = step[ 0 ];

    // args: step, relative, history
    } else if ( typeof branch === bool ) {
        history = relative;
        relative = branch;
        branch = undefined;
    }

    this._move( step, branch, relative, history, function( stepIndex, stepsTaken ) {
        this._update( event, this._state( stepIndex, stepsTaken ) );
    });
},

编辑:感谢@Kokos,我发现这在 Firefox 中工作正常,但在 Internet Explorer 中不起作用!有人知道如何让它在 IE 中工作吗?

I am working with a built jQuery Wizard on this site: http://kflorence.github.com/jquery-wizard/examples/ and the one I am working with is the "Branching Wizard." Based on your selections, you will go to different questions/answers.

My problem is I built the wizard with about 4 questions so far, but when you hit the "Backwards" button you only go back once. I want to be able to keep clicking the "Backwards" button to go through all the previous questions I went through.

I am guessing this is the section of the code I need to edit? I just can't figure it out:

select: function( event, step, branch, relative, history ) {

    // args: step, branch, relative, history
    if ( !( event instanceof $.Event ) ) {
        history = relative;
        relative = branch;
        branch = step;
        step = event;
        event = undefined;
    }

    if ( step == undefined ) {
        return;
    }

    // args: [ step, branch ], relative, history
    if ( $.isArray( step ) ) {
        history = relative;
        relative = branch;
        branch = step[ 1 ];
        step = step[ 0 ];

    // args: step, relative, history
    } else if ( typeof branch === bool ) {
        history = relative;
        relative = branch;
        branch = undefined;
    }

    this._move( step, branch, relative, history, function( stepIndex, stepsTaken ) {
        this._update( event, this._state( stepIndex, stepsTaken ) );
    });
},

EDIT: Thanks to @Kokos, I have discovered that this works fine in Firefox, but does NOT work in Internet Explorer!! Anyone have even the slightest idea how to get it to work in IE?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

橘亓 2024-11-25 05:10:29

This has since been fixed in this revision: https://github.com/kflorence/jquery-wizard/issues/4

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文