Home  >  Article  >  Web Front-end  >  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

不言
不言Original
2018-06-12 10:48:561948browse

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")
    
  })
});
//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")
  }
});

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!

Statement:
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