Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/git/25.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
通过按钮/链接触发Wordpress图像库_Wordpress_Button_Hyperlink_Gallery_Lightbox - Fatal编程技术网

通过按钮/链接触发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

我想用按钮或链接打开灯箱中的默认Wordpress图库,并隐藏页面上的图库缩略图。我怎样才能做到这一点

图库快捷码:
[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”)。触发器(“单击”)