Как реализовать step by step?

170
12 января 2019, 21:40
<div class="calc_nav">
        <!-- before_active -  -->
        <!-- active - активний -->

        <span data-step="0" class="before_active"><em>Генотип</em></span>
        <span data-step="1" class="before_active"><em>Фиброз</em></span>
        <span data-step="2" class="active"><em>Интерферон</em></span>
        <span data-step="3" class=""><em>ВИЧ</em></span>
        <span data-step="4" class="result"><em>Результат</em></span>
      </div>
      <form role="form">
          <div class="panel panel-primary setup-content" id="step-1">
              <div class="panel-heading">
                   <h3 class="panel-title">Генотип</h3>
              </div>
              <div class="panel-body">
                  <div class="form-group form-check form-check-inline">
                    <input class="form-check-input" required="required" type="radio" name="exampleRadios" id="exampleRadios1" value="option1">
                    <label class="form-check-label" for="exampleRadios1">
                      Генотип 1
                    </label>
                  </div>
                  <div class="form-group form-check form-check-inline">
                    <input class="form-check-input" required="required" type="radio" name="exampleRadios" id="exampleRadios2" value="option2">
                    <label class="form-check-label" for="exampleRadios2">
                      Генотип 2
                    </label>
                  </div>
                  <div class="form-group form-check form-check-inline">
                    <input class="form-check-input" required="required" type="radio" name="exampleRadios" id="exampleRadios3" value="option3">
                    <label class="form-check-label" for="exampleRadios3">
                      Генотип 3
                    </label>
                  </div>
                  <button class="btn btn-primary nextBtn" type="button">Далее</button>
              </div>
          </div>
          <div class="panel panel-primary setup-content" id="step-2">
              <div class="panel-heading">
                   <h3 class="panel-title">Фиброз</h3>
              </div>
              <div class="panel-body">
                  <div class="form-group">
                      <label class="control-label">Name</label>
                      <input maxlength="200" type="text" required="required" class="form-control" placeholder="Enter Company Name" />
                  </div>
                  <button class="btn btn-primary nextBtn" type="button">Далее</button>
              </div>
          </div>
          <div class="panel panel-primary setup-content" id="step-3">
              <div class="panel-heading">
                   <h3 class="panel-title">Интерферон</h3>
              </div>
              <div class="panel-body">
                  <div class="form-group">
                      <label class="control-label">Name</label>
                      <input maxlength="200" type="text" required="required" class="form-control" placeholder="Enter Company Name" />
                  </div>
                  <button class="btn btn-primary nextBtn" type="button">Далее</button>
              </div>
          </div>
          <div class="panel panel-primary setup-content" id="step-4">
              <div class="panel-heading">
                   <h3 class="panel-title">ВИЧ</h3>
              </div>
              <div class="panel-body">
                  <div class="form-group">
                      <label class="control-label">Name</label>
                      <input maxlength="200" type="text" required="required" class="form-control" placeholder="Enter Company Name" />
                  </div>
                  <button class="btn btn-primary nextBtn" type="button">Далее</button>
              </div>
          </div>
          <div class="panel panel-primary setup-content" id="step-5">
              <div class="panel-heading">
                   <h3 class="panel-title">Результат</h3>
              </div>
              <div class="panel-body">
                  <div class="form-group">
                      <label class="control-label">Name</label>
                      <input maxlength="200" type="text" required="required" class="form-control" placeholder="Enter Company Name" />
                  </div>
                  <button class="btn btn-success" type="submit">Отправить</button>
              </div>
          </div>
      </form>
Answer 1

Скрываем все панели кроме первой добавляя класс hidden. При нажатии на Далее текущую панель скрываем, а следующую показываем.

$(function() { 
  $('.nextBtn').on('click', function() { 
    var self = $(this); 
    var panel = self.closest('.panel'); 
    var next = panel.next(); 
     
    panel.addClass('hidden'); 
    next.removeClass('hidden'); 
  }) 
});
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin="anonymous"> 
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script> 
<div class="container"> 
 
      <form role="form"> 
          <div class="panel panel-primary setup-content" id="step-1"> 
              <div class="panel-heading"> 
                   <h3 class="panel-title">Генотип</h3> 
              </div> 
              <div class="panel-body"> 
                  <div class="form-group form-check form-check-inline"> 
                    <input class="form-check-input" required="required" type="radio" name="exampleRadios" id="exampleRadios1" value="option1"> 
                    <label class="form-check-label" for="exampleRadios1"> 
                      Генотип 1 
                    </label> 
                  </div> 
                  <div class="form-group form-check form-check-inline"> 
                    <input class="form-check-input" required="required" type="radio" name="exampleRadios" id="exampleRadios2" value="option2"> 
                    <label class="form-check-label" for="exampleRadios2"> 
                      Генотип 2 
                    </label> 
                  </div> 
                  <div class="form-group form-check form-check-inline"> 
                    <input class="form-check-input" required="required" type="radio" name="exampleRadios" id="exampleRadios3" value="option3"> 
                    <label class="form-check-label" for="exampleRadios3"> 
                      Генотип 3 
                    </label> 
                  </div> 
                  <button class="btn btn-primary nextBtn" type="button">Далее</button> 
              </div> 
          </div> 
 
          <div class="panel hidden panel-primary setup-content" id="step-2"> 
              <div class="panel-heading"> 
                   <h3 class="panel-title">Фиброз</h3> 
              </div> 
              <div class="panel-body"> 
                  <div class="form-group"> 
                      <label class="control-label">Name</label> 
                      <input maxlength="200" type="text" required="required" class="form-control" placeholder="Enter Company Name" /> 
                  </div> 
                  <button class="btn btn-primary nextBtn" type="button">Далее</button> 
              </div> 
          </div> 
 
          <div class="panel hidden panel-primary setup-content" id="step-3"> 
              <div class="panel-heading"> 
                   <h3 class="panel-title">Интерферон</h3> 
              </div> 
              <div class="panel-body"> 
                  <div class="form-group"> 
                      <label class="control-label">Name</label> 
                      <input maxlength="200" type="text" required="required" class="form-control" placeholder="Enter Company Name" /> 
                  </div> 
                  <button class="btn btn-primary nextBtn" type="button">Далее</button> 
              </div> 
          </div> 
 
          <div class="panel hidden panel-primary setup-content" id="step-4"> 
              <div class="panel-heading"> 
                   <h3 class="panel-title">ВИЧ</h3> 
              </div> 
              <div class="panel-body"> 
                  <div class="form-group"> 
                      <label class="control-label">Name</label> 
                      <input maxlength="200" type="text" required="required" class="form-control" placeholder="Enter Company Name" /> 
                  </div> 
                  <button class="btn btn-primary nextBtn" type="button">Далее</button> 
              </div> 
          </div> 
 
          <div class="panel hidden panel-primary setup-content" id="step-5"> 
              <div class="panel-heading"> 
                   <h3 class="panel-title">Результат</h3> 
              </div> 
              <div class="panel-body"> 
                  <div class="form-group"> 
                      <label class="control-label">Name</label> 
                      <input maxlength="200" type="text" required="required" class="form-control" placeholder="Enter Company Name" /> 
                  </div> 
                  <button class="btn btn-success" type="submit">Отправить</button> 
              </div> 
          </div> 
      </form> 
      </div>

READ ALSO
Зависимые select2

Зависимые select2

имею обычный select к которому применен select2

189
Как сделать эффект преломления света на изображении [закрыт]

Как сделать эффект преломления света на изображении [закрыт]

Реально ли сделать такой эффект с помощью css или js?

140
phpMyAdmin SSL защита MariaDB (Amazon AWS Linux2 LAMP server)

phpMyAdmin SSL защита MariaDB (Amazon AWS Linux2 LAMP server)

Я особо не разбираюсь в networking-еЯ создал сервер на Amazon AWS на основе Amazon Linux2, установил на него LAMP, подсоединил к нему Elactic IP, который соединил...

142