だから私はどこかでこれをねじっているのを知っていますが、私はそれを理解できません。イメージをライトボックスに動的にロードする
私はライトギャラリーと呼ばれるライトボックスを実行しています。 lightgallery.min.jsとlightgallery.min.cssを参照し、正しいフォルダにファイルを保存しています。/cssと/ js
動的に画像を呼び出すには、次のスクリプトを実行しようとしています。 (ここLightGalleryから取られた私は単に私のシステム上の画像を参照した。
$('.#dynamic').on('click', function() {
$(this).lightGallery({
dynamic: true,
dynamicEl: [{
"src": '/img/splash/header.jpg',
'thumb': '/img/splash/header.jpg',
'subHtml': '<h4>Cover</h4><p>Test image</p>'
}, {
"src": '/img/splash/header.jpg',
'thumb': '/img/splash/header.jpg',
'subHtml': "<h4>Bowness Bay</h4><p>A beautiful Sunrise this morning taken En-route to Keswick not one as planned but I'm extremely happy I was passing the right place at the right time....</p>"
}, {
"src": '/img/splash/header.jpg',
'thumb': '/img/splash/header.jpg',
'subHtml': "<h4>Coniston Calmness</h4><p>Beautiful morning</p>"
}]
})
});
私は、しかし、私はロードするライトボックスを得ることができない、ダイナミックのIDで自分のページ上のボタンを持っている。
<button class="btn btn-success btn-lg mrb50" id="dynamic">Launch Gallery
</button>
私は頭とも私のページの本文にスクリプトを配置しようとしているが、私はちょうどそれが実行するために取得することができる。何かアドバイスをいただければ幸いないよ。
変更 '( '#ダイナミック ')'(' #dynamic') ''に – madalinivascu