toggleClass and remove class from all other elements

前端 未结 6 546
感动是毒
感动是毒 2020-12-01 03:18

How can I toggleClass and remove class from all other elements? Consider a div that contains a tags: html:


      
6条回答
  •  孤城傲影
    2020-12-01 03:39

    
    
        
        On click Change Css
        
        
        
    
    
    
    
    
        

    This is main Heading

    It is a long established fact that a reader will be distracted by the readable content of a page when looking at its layout. The point of using Lorem Ipsum is that it has a more-or-less normal distribution of letters, as opposed to using 'Content here, content here', making it look like readable English. Many desktop publishing packages and web page editors now use Lorem Ipsum as their default model text, and a search for 'lorem ipsum' will uncover many web sites still in their infancy. Various versions have evolved over the years, sometimes by accident, sometimes on purpose (injected humour and the like).

    This is main Heading

    It is a long established fact that a reader will be distracted by the readable content of a page when looking at its layout. The point of using Lorem Ipsum is that it has a more-or-less normal distribution of letters, as opposed to using 'Content here, content here', making it look like readable English. Many desktop publishing packages and web page editors now use Lorem Ipsum as their default model text, and a search for 'lorem ipsum' will uncover many web sites still in their infancy. Various versions have evolved over the years, sometimes by accident, sometimes on purpose (injected humour and the like).

    This is main Heading

    It is a long established fact that a reader will be distracted by the readable content of a page when looking at its layout. The point of using Lorem Ipsum is that it has a more-or-less normal distribution of letters, as opposed to using 'Content here, content here', making it look like readable English. Many desktop publishing packages and web page editors now use Lorem Ipsum as their default model text, and a search for 'lorem ipsum' will uncover many web sites still in their infancy. Various versions have evolved over the years, sometimes by accident, sometimes on purpose (injected humour and the like).

    Css

    .main {
      width:300px;
      margin:30px;
      margin:20px 25px;
      text-align:center;
      background-color:#CCC;
      padding:20px;
      display:inline-block;
    }
    .main:hover {
      cursor:pointer;
    }
    .main1 {
      width:300px;
      margin:30px;
      margin:20px 25px;
      text-align:center;
      background-color:#CCC;
      padding:20px;
      border:3px solid #036;
    }
    

提交回复
热议问题