今天才发现原来筛选标签还可以这么用。
not(expr|ele | fn):从匹配元素的集合中删除与指定表达式匹配的元素
下面demo中的使用: var $category = $(".sub-category-box>ul>li:gt(2):not(:last)"); //列表中索引大于2的,除了最后一个
filter(expr|obj|ele|fn) :r筛选出与指定表达式匹配的元素集合。这个方法用于缩小匹配的范围。用逗号分隔多个表达式
$("ul>li").filter(":contains('佳能'),:contains('索尼'),:contains('三星')") .toggleClass("promoted");// 筛选出li标签中包含佳能、索尼、三星的标签,并设置class
找个demo中使用了这两个方法。 突然感觉 jQuery真的是好强大。
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Title</title>
<style>
*{
margin: 0;
padding: 0;
}
.sub-category-box{
width: 300px;
border: 1px solid #000;
margin: 20px auto;
background-color: gainsboro;
}
.sub-category-box ul{
list-style: none;
width: 100%;
overflow: hidden;
}
.sub-category-box ul li{
float: left;
width: 95px;
height: 35px;
text-align: center;
background-color: darkorange;
box-sizing: border-box;
line-height: 40px;
border-radius: 5px;
margin: 2px;
}
.promoted{
background-color: red !important;
color: white !important;
}
.sub-category-box .show-more{
width: 100%;
height: 30px;
border: 1px solid #000;
text-align:center;
}
.sub-category-box .show-more a{
text-decoration: none;
line-height: 30px;
}
</style>
<script src="/UploadFiles/2021-04-02/jquery.min.js">
以上就是本文的全部内容,希望本文的内容对大家的学习或者工作能带来一定的帮助,同时也希望多多支持!
标签:
折叠菜单,选择器
免责声明:本站文章均来自网站采集或用户投稿,网站不提供任何软件下载或自行开发的软件!
如有用户或公司发现本站内容信息存在侵权行为,请邮件告知! 858582#qq.com
白云城资源网 Copyright www.dyhadc.com
暂无“折叠菜单及选择器的运用”评论...
更新日志
2025年10月27日
2025年10月27日
- 小骆驼-《草原狼2(蓝光CD)》[原抓WAV+CUE]
- 群星《欢迎来到我身边 电影原声专辑》[320K/MP3][105.02MB]
- 群星《欢迎来到我身边 电影原声专辑》[FLAC/分轨][480.9MB]
- 雷婷《梦里蓝天HQⅡ》 2023头版限量编号低速原抓[WAV+CUE][463M]
- 群星《2024好听新歌42》AI调整音效【WAV分轨】
- 王思雨-《思念陪着鸿雁飞》WAV
- 王思雨《喜马拉雅HQ》头版限量编号[WAV+CUE]
- 李健《无时无刻》[WAV+CUE][590M]
- 陈奕迅《酝酿》[WAV分轨][502M]
- 卓依婷《化蝶》2CD[WAV+CUE][1.1G]
- 群星《吉他王(黑胶CD)》[WAV+CUE]
- 齐秦《穿乐(穿越)》[WAV+CUE]
- 发烧珍品《数位CD音响测试-动向效果(九)》【WAV+CUE】
- 邝美云《邝美云精装歌集》[DSF][1.6G]
- 吕方《爱一回伤一回》[WAV+CUE][454M]