使用jQuery步骤进行自定义步骤 [英] Going to a custom step with jQuery-steps

查看:395
本文介绍了使用jQuery步骤进行自定义步骤的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在我的应用上使用了 jQuery-步骤以获得类似向导的情况。我无法找到如何更改为自定义步骤。任何帮助这个?

I am using a jQuery-steps on my app to for a wizard-like situation. I am having trouble finding out how to change to a custom step though. Any help with this one?

$(function () {
    $("#wizard").steps({
        headerTag: "h2",
        bodyTag: "section",
        transitionEffect: "slideLeft",
        enableFinishButton: false,
        labels: {
            next: $('#next').html(),
            previous : $('#previous').html()

        },
        onStepChanged: function (event, currentIndex, priorIndex)
        {
            if( priorIndex == 0) {
                var selected = $('input[name=radio_wizard]:checked', '#radio_wizard').val()
                switch( selected ){
                    case 1:
                        // GOTO 1 
                        break;
                    case 2:
                        // GOTO 2 
                        break;
                    case 3:
                        // GOTO 3 
                        break;
                }
            }
      }
}

如何做到这一点?

推荐答案

我做了这个,所以我创建了这个新函数:

I did this so I created this new function:

function _goToStep(wizard, options, state, index)
{
    return paginationClick(wizard, options, state, index);
}

而且这个调用没有实现,放这个:

And the call that is not implemented, put this:

$.fn.steps.setStep = function (step)
{

    var options = getOptions(this),
        state = getState(this);

    return _goToStep(this, options, state, step);

};

只要利用已经存在的插件即可。

Just taking advantage of what already existed plugin.

使用:

wizard.steps("setStep", 1);

这篇关于使用jQuery步骤进行自定义步骤的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆