如何强制用户在bootstraptour中单击按钮步骤?

时间:2017-12-16 07:15:26

标签: twitter-bootstrap

  

我将在第一次使用bootstraptour为我的aplication用户制作指南,并且我想让用户无法点击除步骤中的按钮之外的其他按钮。感谢。

1 个答案:

答案 0 :(得分:0)

在这里,您可以使用事件方法preventDefault()来停止默认行为。

了解更多here



$(".disable-buttons button:not(.next-button)").on("click", function(event){
  event.preventDefault();
});

<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<!-- Latest compiled and minified CSS -->
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin="anonymous">

<!-- Optional theme -->
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap-theme.min.css" integrity="sha384-rHyoN1iRsVXV4nD0JutlnGaslCJuC7uwjduW9SVrLvRYooPp2bWYgmgJQIXwl/Sp" crossorigin="anonymous">

<!-- Latest compiled and minified JavaScript -->
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js" integrity="sha384-Tc5IQib027qvyjSMfHjOMaLkfuWVxZxUPnCJA7l2mCWNIpG9mGCD8wGNIcPD7Txa" crossorigin="anonymous"></script>
<div class="disable-buttons">
<a href="www.google.com"><button class="btn btn-primary">1</button></a>
<a href="www.google.com"><button class="btn btn-primary">2</button></a>
<a href="www.google.com"><button class="btn btn-primary">3</button></a>
<a href="www.google.com"><button class="btn btn-primary">4</button></a>
<a href="www.google.com"><button class="btn btn-primary">5</button></a>
<a href="www.google.com"><button class="btn btn-primary">6</button></a>
<a href="www.google.com"><button class="btn btn-primary next-button">7</button></a>
</div>
&#13;
&#13;
&#13;