2016-04-18 7 views
1

私はHopscotchを使用してツアーを作成しています。ユーザーが一度ヒットした後、ツアーを終了することができます。Hopscotch on closeツアー機能

私はonClose関数を作成しようとしていますが、私は立ち往生しています。

var tour = { 
    id: "businesstour-hopscotch", 
    steps: [ 
{ 
    title: "Welcome", 
    content: "This is the new business profile page, click next to have a quick tour.", 
    target: document.querySelector('#companyname'), 
    placement: "right", 
    xOffset: -380, 
    yOffset: 52, 
    onClose: function() { 
    window.location = '/'; 
    } 
}, 

などなどです。動作しません。ツアーを終了するボタンも表示されません。 アイデアがあれば助かります!

答えて

0

ドキュメントの私の理解から、OnCloseの定義は「ツアーオプション」で、代わりにステップの内側の、そのように宣言する必要があります

var tour = { 
    id: "businesstour-hopscotch", 
    onClose: function() { 
     window.location = '/'; 
    }, 
    steps: [{ 
     title: "Welcome", 
     content: "This is the new business profile page, click next to have a quick tour.", 
     target: document.querySelector('#companyname'), 
     placement: "right", 
     xOffset: -380, 
     yOffset: 52 
    }] 
}; 

私は、ユーザーのために働く、このような鉱山を初期化していますツアーの右上にある「x」をクリックしてください。ただし、私はではないツアーの最後のステップでユーザーが[完了]ボタンをクリックしたときにこのイベントが発生するのを見ています。

関連する問題