アプリにホップスコッチツアーをいくつか実装しています。
これまで問題なく多くのツアーをこなしてきましたが、今日は解決できなかった課題に直面しています。
私の質問は、動的に生成されたコンテンツで動作するツアー ステップ ターゲットを取得するにはどうすればよいですか?
HTMLは次のとおりです。
<div class="pacote-destino-quartos-wrapper">
<div class="pacote-destino-quartos-internal-wrapper">
<h4>Todos os Destinos</h4>
<div class="dynamic_nested_form_wrapper quartos_external_wrapper" data-destino="todos">
<span class="add-child-link-wrapper">
<a href="javascript:void(0)" class="add_child btn btn-info" data-association="quartos">
<i class="icon-plus icon-white"></i>
</a>
</span>
</div>
</div>
</div>
リンクをクリックするたびに、多くの要素を含む div が動的に作成されます。そのうちの 1 つは、というクラスを持つ div.quarto-config-wrapper
です。
Hopscotch ツアーをこの要素に移動させようとしても、うまくいきません。私の推測では、動的に作成された要素は DOM で操作することはできません。
これが私のHopscotchステップコードです:
{
title: "Adicionar um novo quarto",
content: "content here",
target: $('.add-child-link-wrapper')[0],
placement: "left",
width: 500,
yOffset: -15,
nextOnTargetClick: true,
showNextButton: false
},
{
title: "Menu de configuração do quarto",
content: "content here",
target: $('.quarto-config-wrapper')[0],
placement: "left",
width: 700,
yOffset: -15,
nextOnTargetClick: true,
showNextButton: false,
delay: 1200
}
最初のステップは機能しますが、2 番目のステップは機能しません。
私は何を間違っていますか?どうすれば修正できますか?