Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/jquery/87.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript 跳过stepy jQuery插件中的隐藏步骤_Javascript_Jquery_Jquery Plugins - Fatal编程技术网

Javascript 跳过stepy jQuery插件中的隐藏步骤

Javascript 跳过stepy jQuery插件中的隐藏步骤,javascript,jquery,jquery-plugins,Javascript,Jquery,Jquery Plugins,我需要跳过一步,但不知道怎么做。我正在使用回调,但不起作用,这是我的代码: next: function(index) { console.log(index); if ($('#product_create-head-2').is(':hidden')) { $('#product_create').find('fieldset').eq(2).hide(); $('#product_create').fi

我需要跳过一步,但不知道怎么做。我正在使用回调,但不起作用,这是我的代码:

    next: function(index) {
        console.log(index);
        if ($('#product_create-head-2').is(':hidden')) {
            $('#product_create').find('fieldset').eq(2).hide();
            $('#product_create').find('fieldset').eq(3).show();
            $('#product_create').stepy('step', 3);
        }
    },
    back: function(index) {
        console.log(index);
        if ($('#product_create-head-2').is(':hidden')) {
            $('#product_create').find('fieldset').eq(2).hide();
            $('#product_create').find('fieldset').eq(1).show();
            $('#product_create').stepy('step', 1);
        }
    }
默认情况下,
$(“#product_create-head-2”)
是隐藏的,但可以通过用户交互显示,因此,如果在按下下一步/上一步时它是隐藏的,则应跳过此步骤并转到下一步/上一步,具体取决于用户操作,我做错了什么?

您可以在这样的代码中使用stepy的“选择”功能:

next: function(step){  // invoked by next button
          wzDir = 'fw'; //set direction forward
      },
back: function(step){  // invoked by back button
          wzDir = 'bw'; //set direction backward  
      },
select: function(step){
          if (step == 2){ //invoked on every selected step
            switch (wzDir){
              case 'fw': $('#product_create').stepy('step', 3); //jump to 3 
                         break; 
              case 'bw': $('#product_create').stepy('step', 1); //jump to 1
                         break; 
            }
          }
      }
这一定有用