0

我使用的是(Step Wizard with Bootstrap 4)的电影,我的 bootstrap 版本是 4.5.1。

  • 链接: https ://www.youtube.com/watch?v=5czWkFFLdQc

     <!doctype html>
    <html lang="en">
    <head>
      <meta charset="utf-8">
      <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
      <link rel="stylesheet" href="css/bootstrap.min.css">
      <link rel="stylesheet" href="css/smart_wizard.min.css">
    
      <title>Hello, world!</title>
    </head>
    <body>
    <div class="container mt-5 mb-5">
      <div id="stepWizard">
        <ul>
          <li><a href="#step1">Step Title 1<br><small>Step Description 1</small></a></li>
          <li><a href="#step2">Step Title 2<br><small>Step Description 2</small></a></li>
          <li><a href="#step3">Step Title 3<br><small>Step Description 3</small></a></li>
          <li><a href="#step4">Step Title 4<br><small>Step Description 4</small></a></li>
          <li><a href="#step5">Step Title 5<br><small>Step Description 5</small></a></li>
        </ul>
        <div>
          <div id="step1">Step Content 1</div>
          <div id="step2">Step Content 2</div>
          <div id="step3">Step Content 3</div>
          <div id="step4">Step Content 4</div>
          <div id="step5">Step Content 5</div>
        </div>
      </div>
    </div>
    <script src="js/jquery-3.5.1.slim.min.js"></script>
    <script src="js/jquery-3.5.1.min.js"></script>
    <script src="js/popper.min.js"></script>
    <script src="js/bootstrap.min.js"></script>
    <script src="js/jquery.smartWizard.min.js"></script>
    <script>
        $('#stepWizard').smartWizard();
    </script>
    </body>
    </html>
    

我看到了这个演示。

智能向导

我的代码不工作,但在 youtube 工作。

4

2 回答 2

1

我遇到了同样的问题并找到了解决方法:看看这个页面,它对我有很大帮助!

请注意,您必须使用 jquery.min.js 或 jquery.js 而不是“苗条”版本。

它适用于我的代码:

<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Step Wizard</title>
    <link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.5.0/css/bootstrap.min.css"
        integrity="sha384-9aIt2nRpC12Uk9gS9baDl411NQApFmC26EwAOH8WgZl5MYYxFfc+NcPb1dKGj7Sk" crossorigin="anonymous">
    <link href="https://cdn.jsdelivr.net/npm/smartwizard@5/dist/css/smart_wizard_all.min.css" rel="stylesheet"
        type="text/css" />
</head>

<body>
    <div class="container mt-5 mb-5">
        <div id="stepwizard">
            <ul class="nav">
                <li class="nav-item"><a href="#step1" class="nav-link">Step Title 1 <br> <small>Step Description
                            1</small></a></li>
                <li class="nav-item"><a href="#step2" class="nav-link">Step Title 2 <br> <small>Step Description
                            2</small></a></li>
                <li class="nav-item"><a href="#step3" class="nav-link">Step Title 3 <br> <small>Step Description
                            3</small></a></li>
                <li class="nav-item"><a href="#step4" class="nav-link">Step Title 4 <br> <small>Step Description
                            4</small></a></li>
                <li class="nav-item"><a href="#step5" class="nav-link">Step Title 5 <br> <small>Step Description
                            5</small></a></li>
            </ul>
            <div class="tab-content">
                <div id="step1" class="tab-pane" role="tabpanel" aria-labelledby="step-1">Step Content 1</div>
                <div id="step2" class="tab-pane" role="tabpanel" aria-labelledby="step-2">Step Content 2</div>
                <div id="step3" class="tab-pane" role="tabpanel" aria-labelledby="step-3">Step Content 3</div>
                <div id="step4" class="tab-pane" role="tabpanel" aria-labelledby="step-4">Step Content 4</div>
                <div id="step5" class="tab-pane" role="tabpanel" aria-labelledby="step-5">Step Content 5</div>
            </div>
        </div>
    </div>

    <script src="https://code.jquery.com/jquery-3.5.1.js"
        integrity="sha256-QWo7LDvxbWT2tbbQ97B53yJnYU3WhH/C8ycbRAkjPDc=" crossorigin="anonymous"></script>
    <script src="https://cdn.jsdelivr.net/npm/popper.js@1.16.0/dist/umd/popper.min.js"
        integrity="sha384-Q6E9RHvbIyZFJoft+2mJbHaEWldlvI9IOYy5n3zV9zzTtmI3UksdQRVvoxMfooAo"
        crossorigin="anonymous"></script>
    <script src="https://stackpath.bootstrapcdn.com/bootstrap/4.5.0/js/bootstrap.min.js"
        integrity="sha384-OgVRvuATP1z7JjHLkuOU7Xw704+h835Lr+6QL9UvYjZE3Ipu6Tp75j7Bh/kR0JKI"
        crossorigin="anonymous"></script>
    <script src="https://cdn.jsdelivr.net/npm/smartwizard@5.1.1/dist/js/jquery.smartWizard.min.js"
        integrity="sha256-ZDS9YBVOz85XYQvtiZg1ZMZOk+4dLz/MpYxxzsg5GdQ=" crossorigin="anonymous"></script>

    <script>
        $(document).ready(function () {
            $('#stepwizard').smartWizard();
        });
    </script>
</body>

</html>

祝你一切顺利!

于 2020-07-20T14:30:09.877 回答
0

对我来说,解决方案是我缺少 ul 元素中的“nav”类,所以你可能想调查一下。

<ul class="nav">
  <li>
   <a class="nav-link" href="#step-1">
    Step 1
   </a>
  </li>
  <li>
   <a class="nav-link" href="#step-2">
    Step 2
   </a>
  </li>
  <li>
   <a class="nav-link" href="#step-3">
    Step 3
   </a>
  </li>
  <li>
   <a class="nav-link" href="#step-4">
    Step 4
   </a>
  </li>
 </ul>

于 2022-02-17T16:20:55.337 回答