<ul> <li data-filter="all">全部</li> <li data-filter="1">城市</li> <li data-filter="2">自然</li> <li data-filter="3">工业</li> <li data-filter="4">白昼</li> <li data-filter="5">夜景</li> </ul> <div> <div data-category="1, 5"> <img src="img/a1.png" alt=""> </div> <div data-category="2, 5"> <img src="img/a2.png" alt=""> </div> <div data-category="1, 4"> <img src="img/a3.png" alt=""> </div> <div data-category="3"> <img src="img/a4.png" alt=""> </div> <div data-category="3, 4"> <img src="img/a5.png" alt=""> </div> </div>
jq22内的data-category属性里面的数字填上 nav内的data-filter属性里面的数字,可以多选 以逗号,隔开