Home > Web Front-end > CSS Tutorial > Use js traversal to add column classes, add css and then click other implementation methods to delete css

Use js traversal to add column classes, add css and then click other implementation methods to delete css

不言
Release: 2018-06-12 10:48:56
Original
2021 people have browsed it

This article mainly introduces the example code of js traversal, adding column class, adding css and then clicking on other to delete css. It is very good and has certain reference value. Friends who need it can refer to the specific code

As follows:

//js遍历添加栏目类添加css 再点击其它删除css

$(".radio-group .ckselect").each(function(index) {
  $(this).click(function() {
    var tagid=$(this).attr('tagid');
    $("#tagid").val(tagid)
    $(".ckselect").removeClass("selected");
    $(".ckselect").eq(index).addClass("selected")
    
  })
});
Copy after login
//js点击显示关闭层,空白区域也关闭  
$(".zu-top-nav-userinfo").click(function(e) {
  if ($(".peoples").hasClass("allhide")) {
    $(".peoples").hide();
    $(".peoples").removeClass("allhide");
    return
  }
  e.stopPropagation();
  $(".peoples").show();
  $(".peoples").addClass("allhide")
});
$(document).click(function() {
  if ($(".peoples").hasClass("allhide")) {
    $(".peoples").hide();
    $(".peoples").removeClass("allhide")
  }
});
Copy after login

The above is the entire content of this article. I hope it will be helpful to everyone’s study. For more related content, please pay attention to the PHP Chinese website!

Related recommendations:

How to upload multiple H5 images under Angular

The above is the detailed content of Use js traversal to add column classes, add css and then click other implementation methods to delete css. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template