[英]How can I link a button when clicked to open a lightbox gallery?
Or open anything for that matter. 或者打开任何事情。
What is the correct script syntax for a button event of this sort. 这种按钮事件的正确脚本语法是什么。
Not sure whether it makes a difference but I'm attempting to follow the fotorama plugin - http://fotorama.io/ 不确定它是否有所作为,但我正在尝试关注fotorama插件 - http://fotorama.io/
My html: 我的HTML:
<div class="Gal"
<div class="fotorama" data-nav="thumbs" data-transition="crossfade">
<img src="Gallery/1.jpg" data-caption="One">
<img src="Gallery/2.jpg">
<img src="Gallery/3.jpg">
<img src="Gallery/4.jpg">
</div>
<button type="button" id="gallery-button">Click Me!</button>
</div>
Overall I would like to display, a set of 4 images first, as their 'own' lightbox gallery as such, and then have a button underneath which would when clicked would bring up the another lightbox gallery with more images. 总的来说,我想首先显示一组4个图像作为他们自己的灯箱库,然后在下面有一个按钮,当点击它时会显示另一个带有更多图像的灯箱库。
Is the 2 gallery method the correct way to go about this? 2画廊方法是正确的方法吗? Or can I somehow only display a certain few (for instance first 4) images in the set in 2 different areas while the 2nd gallery adds more.
或者我可以以某种方式仅在2个不同区域中的集合中显示一些(例如前4个)图像,而第二个图库添加更多。
I don't know if i understood your qustion right: 我不知道我是否理解你的健康权利:
you want to have a preview lightbox and then, when a button is clicked, show the full gallery? 你想要一个预览灯箱,然后,当点击一个按钮时,显示完整的画廊?
You can add elemts in html via innerHtml like that: 您可以通过innerHtml在html中添加elemts, 如下所示:
function addElementsToGalery(){
document.getElementById("fotorama").innerHTML = document.getElementById("fotorama").innerHTML + '<img src="Gallery/5.jpg"><img src="Gallery/6.jpg"><img src="Gallery/7.jpg">';}
and the updated html: 和更新的HTML:
<div class="Gal">
<div id="fotorama" class="fotorama" data-nav="thumbs" data-transition="crossfade">
<img src="Gallery/1.jpg" data-caption="One">
<img src="Gallery/2.jpg">
<img src="Gallery/3.jpg">
<img src="Gallery/4.jpg">
</div>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.