html:

<div id="full" class='weui-popup__container' style="background: #fff">
<div class="weui-popup__overlay"></div>
<div class="weui-popup__modal" style="background: #fff;">
<header class='demos-header'>
<h2 class="demos-second-title">筛选参数</h2> </header>
<article class="weui-article">
<section>
<section class="category">
<h3>潜在需求</h3>
</section>
<section class="pay">
<h3>消费能力</h3>
<span class="tl-ac-span">A</span>
<span class="tl-ac-span">B</span>
<span class="tl-ac-span">C</span>
<span class="tl-ac-span">D</span>
<span class="tl-ac-span">E</span>
</section>
<section class="age">
<h3>年龄层次</h3>
<span class="tl-ac-span">18-25</span>
<span class="tl-ac-span">25-30</span>
<span class="tl-ac-span">30-35</span>
<span class="tl-ac-span">35-40</span>
<span class="tl-ac-span">40-99</span>
</section>
</section>
</article>
<a href="javascript:;" class="weui-btn weui-btn_primary close-popup" style="background: #FF5722;" onclick="getSerch();">确定</a>
</div>
</div>

css:

.tl-span{
width: 64px;
padding: 6px 10px;
border-radius: 8px;
border: 1px solid #84A7FF;
padding-right: 6px;
} .tl-span :active{
background: #F8A311;
}
.box { white-space:nowrap; overflow-x:auto; } /*注释1*/
.box::-webkit-scrollbar { width:; height:; display: none; } /*注释2*/
.tl-bar{
padding: 0 15px;
height: 60px;
line-height: 58px;
}
.left-span{
color:#FF5722;
display:inline-block;
float: left;
}
.right-span{
color:#FF5722;
display:inline-block;
float: right;
}
.tl-ac-span{
display: inline-block;
width: 22%;
height: 36px;
line-height: 36px;
text-align: center;
overflow: hidden;
background: #E7E7E7;
border-radius: 4px;
margin-right: 1%;
}
.active{
color: #FF5722;
background: #FFFFFF;
border: 1px solid #FF5722; }
//绑定点击选中事件
$(".category span").click(function(e){
if(!$(this).hasClass("active")){
//$(this).addClass("active"); //多选
$(this).addClass("active").siblings("span").removeClass("active"); //单选
}else{
$(this).removeClass("active");
}
console.log('event', e.currentTarget.id);
let targId= e.currentTarget.id;
searchObj.tagCategoryIds = targId;
}); $(".pay span").click(function(e){
//$(this).addClass("active").siblings("span").removeClass("active");
if(!$(this).hasClass("active")){
//$(this).addClass("active"); //多选
$(this).addClass("active").siblings("span").removeClass("active"); //单选
}else{
$(this).removeClass("active");
}
let consumeLevels= e.currentTarget.innerText;
searchObj.consumeLevels = consumeLevels;
}); $(".age span").click(function(e){
if(!$(this).hasClass("active")){
//$(this).addClass("active"); //多选
$(this).addClass("active").siblings("span").removeClass("active"); //单选
}else{
$(this).removeClass("active");
}
let age= e.currentTarget.innerText;
searchObj.ageLevels = age;
});

补充:2019-02-26

$(this).addClass('class').siblings('class').removeClass('class')的作用

 

$(this).addClass('class'):为当前元素添加'class'类(供选择器使用 - - )

$(this).siblings('class'):查找当前元素的所有类名为 "class" 的所有同胞元素,也就是有相同类名的同胞元素。(同胞就是拥有相同的父元素)

$(this).removeClass('class'):为当前元素去除'class'类,与addClass作用相反

$(this).addClass('class').siblings('class').removeClass('class'):作用是  给当前元素添加'class'类并查找同胞元素再去除同胞元素的'class'类

最新文章

  1. APP漏洞扫描用地址空间随机化
  2. SQL 2005 服务器更计算机名
  3. Ajax请求中的async:false/true的作用
  4. 在Ubuntu上安装JDK、Ant、Jmeter和Jenkins
  5. NOIP2004 解题报告
  6. (转)android Fragments详解四:管理fragment
  7. TortoiseSVN 插件配置及使用方法
  8. Nginx 禁止访问某个目录或文件的设置方法
  9. linux之getcwd函数解析
  10. AngularJS&ndash;Animations(动画)
  11. 如何安装和配置 Rex-Ray?- 每天5分钟玩转 Docker 容器技术(74)
  12. ionic2+Angular 组件(多个组件)浅谈
  13. tensorflow-用DASC结合Inception-v3对imagenet2012聚类实现
  14. CSS Sprites ——雪碧图的使用方法
  15. 牛客提高集训营6 C 树(树链剖分)
  16. ActiveMQ 中的链表
  17. Vim 文件配置
  18. NAND FLASH控制器
  19. Sql中EXISTS与IN的使用及效率
  20. Jmeter常用脚本开发之Debug Sampler

热门文章

  1. iota妙用
  2. js清空数组
  3. postgresql Kill掉正在执行的SQL语句
  4. 阿里开源线上应用调试利器 Arthas的背后
  5. establish状态,本地ip和端口连接本地ip端口可能是一样的。
  6. 备用shell管理方案之butterfly+nginx+https
  7. hadoop错误记录部分总结
  8. 怎么把分化成元,并且保留两位小数,用vue来做
  9. 关于aes加密
  10. uSurvival 1.41多人在线生存逃杀吃鸡类游戏源码