Giter VIP home page Giter VIP logo

jquery-steps's Introduction

JQuery Steps

去掉了popover,感觉真心弹出提示真心不好用。

另外,空间的宽度过窄,暂时改成手动调节,需要使用者自定义宽度以及空间的宽度。

2016/05/29 更新-->增加响应式布局

布局方法:

计算方法,每个原点之间的距离为x,共有y个原点。则:

  • 进度条容器的宽度为 x*y px
  • 进度条的宽度以及进度条容器宽度为x*(y-1) px
  • 按钮偏移值为 x*y px
/*添加相应式CSS*/
@media (min-width: 768px) {
  /*调节总的宽度*/
  .ystep-lg {
    width: 400px;
  }
  /*调节进度条宽度*/
  .ystep-lg .ystep-progress, .ystep-lg .ystep-progress-bar {
    width: 300px;
  }
  /*调节各个原点之间的跨度*/
  .ystep-lg li {
    margin-right: 0px;
  }
  /*调节按钮位置*/
  .step-button{
    left: 400px;
  }
}
@media (min-width: 992px) {
  /*调节总的宽度*/
  .ystep-lg {
    width: 600px;
  }
  /*调节进度条宽度*/
  .ystep-lg .ystep-progress, .ystep-lg .ystep-progress-bar {
    width: 450px;
  }
  /*调节各个原点之间的跨度*/
  .ystep-lg li {
    margin-right: 50px;
  }
  /*调节按钮位置*/
  .step-button{
    left: 600px;
  }
}
@media (min-width: 1200px) {
  /*调节总的宽度*/
  .ystep-lg {
    width: 800px;
  }
  /*调节进度条宽度*/
  .ystep-lg .ystep-progress, .ystep-lg .ystep-progress-bar {
    width: 600px;
  }
  /*调节各个原点之间的跨度*/
  .ystep-lg li {
    margin-right: 100px;
  }
  /*调节按钮位置*/
  .step-button{
    left: 800px;
  }
}

增加点击按钮事件,以及校验

$(".ystep").loadStep({
  steps:["发起","审核","募款","执行"],
  beforeChange: function(nowIndex,nextIndex){
    console.log("跳转前校验:"+nowIndex +" "+nextIndex);

    if(nowIndex === 1 && nextIndex === 2 ){
      return true;
    }else if(nowIndex === 2 && nextIndex === 3){
      return true;
    }else if(nowIndex === 3 && nextIndex === 4){
      return true;
    }
    return true;
  },
  afterChange: function(nowIndex,prevIndex){
    console.log("跳转后动作:"+nowIndex +" "+prevIndex);

    if(nowIndex <1 || nowIndex >5) return;
    
    /*for(var i = 1; i <= 5; i++){
      if(i === nowIndex){
        $("#page"+i).css("display","block");
      }else{
        $("#page"+i).css("display","none");
      }
    }*/
    
    if(nowIndex === 2 && prevIndex === 1){
      
    }else if(nowIndex === 3 && prevIndex === 2){
      
    }else if(nowIndex === 4 && prevIndex === 3){
      
    }
  }
});

jquery-steps's People

Contributors

xinghalo avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.