Pen Settings

HTML

CSS

CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URL's added here will be added as <link>s in order, and before the CSS in the editor. If you link to another Pen, it will include the CSS from that Pen. If the preprocessor matches, it will attempt to combine them before processing.

+ add another resource

JavaScript

Babel includes JSX processing.

Add External Scripts/Pens

Any URL's added here will be added as <script>s in order, and run before the JavaScript in the editor. You can use the URL of any other Pen and it will include the JavaScript from that Pen.

+ add another resource

Packages

Add Packages

Search for and use JavaScript packages from npm here. By selecting a package, an import statement will be added to the top of the JavaScript editor for this package.

Behavior

Save Automatically?

If active, Pens will autosave every 30 seconds after being saved once.

Auto-Updating Preview

If enabled, the preview panel updates automatically as you code. If disabled, use the "Run" button to update.

Format on Save

If enabled, your code will be formatted when you actively save your Pen. Note: your code becomes un-folded during formatting.

Editor Settings

Code Indentation

Want to change your Syntax Highlighting theme, Fonts and more?

Visit your global Editor Settings.

HTML

              
                <script src="https://unpkg.com/driver.js/dist/driver.min.js"></script>
<link rel="stylesheet" href="https://unpkg.com/driver.js/dist/driver.min.css">
<!-- 最新版本的 Bootstrap 核心 CSS 文件 -->
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap@3.3.7/dist/css/bootstrap.min.css" integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin="anonymous">



<div id="wrap">
      <button type="button" class="btn btn-primary" id="button">开始引导</button>
<form>
  <div class="form-group" id="first-element-introduction">
    <label for="exampleInputEmail1">账号</label>
    <input type="email" class="form-control"  placeholder="账号">
  </div>
  <div class="form-group" id="second-element-introduction" >
    <label for="exampleInputPassword1">密码</label>
    <input type="password" class="form-control" placeholder="密码">
  </div>
  <button type="button" id='third-element-introduction' class="btn btn-success">登录</button>
</form>
   
</div>
              
            
!

CSS

              
                #wrap{
  width: 500px;
  overflow: hidden;
  margin:0 auto;
}
#button{
  margin:50px auto;
  width: 100px;
}
              
            
!

JS

              
                  // Start the introduction
    document.querySelector('#button').onclick = function (e) {

        e.stopPropagation();
        driver()
    }
         document.querySelector('#third-element-introduction').onclick = function (e) {

     alert('你已经完成了新手引导!')
    }

    function driver() {
        const driver = new Driver({
            doneBtnText: '结束', // Text on the final button
            closeBtnText: '关闭',
            nextBtnText: '下一步', // Next button text for this step
            prevBtnText: '上一步',
        });

        // Define the steps for introduction
        driver.defineSteps([{
                element: '#first-element-introduction',
                popover: {
                    title: '这是用于输入账号的地方',
                    description: '试着输入<strong>admin</strong>!',
                }
            },
            {
                element: '#second-element-introduction',
                popover: {
                    title: '这是用于输入密码的地方',
                    description: '试着输入<strong>123</strong>!',
                }
            },
            {
                element: '#third-element-introduction',
                popover: {
                    title: '做的漂亮',
                    description: '试着点击登录按钮体验本网站吧',
                }
            },
        ]);
        driver.start();
    }
              
            
!
999px

Console