簡體   English   中英

如何在燈箱中隱藏特定圖像

[英]how to hide specific image in lightbox

我有在燈箱中打開的圖像,但我希望當noimage.png可以在燈箱中查看時,不應在燈箱視圖中顯示

這是我網站的鏈接,請打開最后的縮略圖並查看下一張圖片以了解。. 單擊此處 我用於燈箱的腳本

<script type="text/javascript" src="LightBox/js/jquery.js"></script>
        <script type="text/javascript" src="LightBox/js/jquery.lightbox-0.5.js"></script>



        <script type="text/javascript">
            $(function() {
                $('#gallery a').lightBox(
{ overlayOpacity: 0.6,
    imageLoading: 'LightBox/images/lightbox-ico-loading.gif',
    imageBtnClose: 'LightBox/images/lightbox-btn-close.gif',
    imageBtnPrev: 'LightBox/images/lightbox-btn-prev.gif',
    imageBtnNext: 'LightBox/images/lightbox-btn-next.gif',
    fixedNavigation: true,
    txtImage: 'Image',
    txtOf: 'of'

});      
  });

  </script>

我試圖完成這項任務

<script type="text/javascript">
       function pageLoad() {
           if ($("#gallery a[href$='noimage.png']")) {
               $("#gallery a[href$='noimage.png'] img").removeAttr("src");

               $("#gallery a[href$='noimage.png']").remove("#gallery img");

           }
       };

  </script>

是否可以在燈箱中隱藏特定圖像,並且不應在燈箱彈出視圖中顯示該圖像

您可以使用一個類來標記要在燈箱中排除的圖像,而這些圖像將不會在燈箱中使用。

標記圖像,然后使用此選擇器初始化燈箱

<script type="text/javascript">
    $(function() {
        // Mark unwanted images
        jQuery('#gallery a[href*="noimage.png"]').addClass("no-lightbox");

        // Initialize lightbox without them
        jQuery('#gallery a:not(.no-lightbox)').lightBox({ 
            overlayOpacity: 0.6,
            imageLoading: 'LightBox/images/lightbox-ico-loading.gif',
            imageBtnClose: 'LightBox/images/lightbox-btn-close.gif',
            imageBtnPrev: 'LightBox/images/lightbox-btn-prev.gif',
            imageBtnNext: 'LightBox/images/lightbox-btn-next.gif',
            fixedNavigation: true,
            txtImage: 'Image',
            txtOf: 'of'
        });      
    });
</script>

理想情況下,渲染視圖時,應檢查是否為noimage.png然后再不打印。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM