Home > Web Front-end > JS Tutorial > js traversal operation css

js traversal operation css

php中世界最好的语言
Release: 2018-06-13 11:35:47
Original
1885 people have browsed it

This time I will bring you js traversal and operation of css. What are the precautions for js traversal and operation of css? The following is a practical case, let’s take a look.

The specific code is 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

I believe you have mastered the method after reading the case in this article. For more exciting information, please pay attention to other related articles on the php Chinese website!

Recommended reading:

Detailed explanation of Vue two-way data binding examples

Detailed explanation of the steps for using function throttling and time-sharing functions

The above is the detailed content of js traversal operation 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