如何根据图库中图像名称的前缀过滤图像



我在图库中显示以下图像,我正在使用Lightbox显示此图像。现在,我想包括一个过滤器,以便我有两个按钮TH和TS。当我单击所有图像时,应显示所有图像,当我单击TS时,所有图像都应在图库中显示所有带有前缀TS的图像。
以下是代码 -

<div id="vlightbox">
        <a id="firstImage" title="Bath Mat" href="images1/TH1.jpg" class="vlightbox">
            <img alt="Bath_Mat" src="images1/TH1.jpg"/>
            <p class="para">
                BATH MAT RUG - PINK<br>
                <strong>Material Used:</strong>Cotton<br>
                <strong>Design:</strong> Square |<strong> Colour:</strong> Pink<br>
                <strong>Size:</strong> As per requirement
            </p>
        </a>
        <a title="Bathmat Cotton Yellow" href="images1/TS1.jpg" class="vlightbox"><img alt="Bathmat-Cotton-Yellow" src="images1/TS1.jpg" />
            <p class="para">BATH MAT RUG - YELLOW<br>
                <strong>Material Used:</strong>Cotton<br>
                <strong>Design:</strong>Stripes | <strong>Colour: </strong>Yellow <br>
                <strong>Size:</strong> As per requirement
            </p>
        </a>
</div>  

如何在图像名称的前缀上的画廊中过滤此图像

$('a.vlightbox[href*="/TS"]');

将为您提供所有a -TAG,带有TS -Images。

TS替换为th-images的TH

最新更新