簡體   English   中英

如何手動啟動Bootstrap Tour?

[英]How to manually start Bootstrap Tour?

我瀏覽了我的網站。 我希望用戶在結束游覽后可以在單擊按鈕時手動開始游覽。

按鍵:

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

引導瀏覽腳本。

<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中的按鈕上添加click事件一樣簡單。

例如:

$('#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(); 
});

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM