2016-07-02 46 views
0

关于为什么下列跳房子不做以下工作的任何想法?我们希望用户能够点击按钮开始游览。 非常感谢!跳房子按钮单击不工作

<html> 
    <head> 
    <title>My First Hopscotch Tour</title> 
    <link rel="stylesheet" href="css/hopscotch.css"> 
    </head> 
    <body> 

    <h1 id="header">My First Hopscotch Tour</h1> 
    <div id="content"> 
     <p>Content goes here...</p> 
    </div> 
    <button id="myBtn">Click Me</button> 

    <script> 
     var tour = { 
     id: "hello-hopscotch", 
     steps: [ 
      { 
      title: "My Header", 
      content: "This is the header of my page.", 
      target: "header", 
      placement: "bottom" 
      }, 
     ] 
     }; 
     $("#myBtn").click(function(){ 
     hopscotch.startTour(tour); 
     }); 
    </script> 

    <script src="js/hopscotch.js"></script> 

    </body> 
</html> 
+0

代码改进缩进。 –

回答

0

加入jQuery脚本:

<script src="https://code.jquery.com/jquery-2.2.4.min.js"></script> 
<script src="js/hopscotch.js"></script> 

查看演示这里:http://codepen.io/ihemant360/pen/OXmqXR

+0

这工作得很好。非常感谢! –

0

你应该在你的文件头部包含jquery库。

即:

<script src="https://code.jquery.com/jquery-3.0.0.min.js" integrity="sha256-JmvOoLtYsmqlsWxa7mDSLMwa6dZ9rrIdtrrVYRnDRH0=" crossorigin="anonymous"></script> 
+0

感谢您的回应!这也工作。 –