通过按钮/链接触发Wordpress图像库
我想用按钮或链接打开灯箱中的默认Wordpress图库,并隐藏页面上的图库缩略图。我怎样才能做到这一点 图库快捷码:通过按钮/链接触发Wordpress图像库,wordpress,button,hyperlink,gallery,lightbox,Wordpress,Button,Hyperlink,Gallery,Lightbox,我想用按钮或链接打开灯箱中的默认Wordpress图库,并隐藏页面上的图库缩略图。我怎样才能做到这一点 图库快捷码:[Gallery id=“55,67”] 提前谢谢。你可以这样试试 <style> .hiddengallery{ display:none; } </style> <button class="showgallery" >click here</button> <div class="h
[Gallery id=“55,67”]
提前谢谢。你可以这样试试
<style>
.hiddengallery{
display:none;
}
</style>
<button class="showgallery" >click here</button>
<div class="hiddengallery">
// add lightbox code here
<?php echo do_shortcode('[gallery ids="55,67"]');?>
</div>
<script>
jQuery(document).on("click",".showgallery", function (){
jQuery(".hiddengallery").show();
});
</script>
希登美术馆{
显示:无;
}
点击这里
//在此处添加灯箱代码
谢谢,但这只是隐藏/取消隐藏图库的缩略图。您需要再次单击其中一个缩略图以在默认灯箱中显示图像。我尝试的是用按钮模拟单击第一个图库缩略图。我通过模拟单击隐藏图库的第一个缩略图来解决此问题:jQuery(“.gallery item:first of type>.gallery icon>a”)。触发器(“单击”)代码>