gpt4 book ai didi

javascript - 如何手动启动 Bootstrap Tour?

转载 作者:行者123 更新时间:2023-11-28 20:09:37 27 4
gpt4 key购买 nike

我通过我的网站进行了游览。我希望用户在结束游览后可以通过单击按钮手动开始游览。

按钮:

<a href="#" id="tour"><i class=""></i> Start Tour</a>

Bootstrap 游览脚本。

<script type="text/javascript">
var tour = new Tour();
tour.addSteps([
{
element: "#step1",
title: "Welcome.",
content: "Welcome to step one.",
placement: "top"
}
]);
tour.addSteps([
{
element: "#step2",
title: "Contact us.",
content: "If you have any questions, please contact us.",
placement: "left"
}

]);
tour.start();
</script>

最佳答案

这应该像在 JavaScript 中向按钮添加单击事件一样简单。

例如:

$('#tour').click(function(e){
tour.start();

// it's also good practice to preventDefault on the click event
// to avoid the click triggering whatever is within href:
e.preventDefault();
});

关于javascript - 如何手动启动 Bootstrap Tour?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20125331/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com