7.1.7 对类样式的操作

 

 

$(function(){

  var isShow=true;

  $('#btn').click(function(){

    // 1. 通过控制类样式属性对盒子显示隐藏

     if (isShow){

      $('.box').css('display','none');

      isShow=false;

      $(this).text("显示");

    }else{

      $('.box').css('display','block');

      isShow=true;

      $(this).text("隐藏");

      }

 

    2. 通过控制类名 addClass()  removeClass()

 

  })

})

posted @ 2018-09-14 18:09  beallaliu  阅读(81)  评论(0编辑  收藏  举报