显示:show()  display:block;

隐藏:hide()   display:none;

当显示和隐藏切换的时候,需要判断此刻是显示还是隐藏,那判断条件常用以下几种方法:

1.if(thisNode.is(':hidden')){......}else{.......}

2.首先给thisNode的Dom元素加class标识,例如改标识为class="showFlag",判断如下

  if(thisNode.hasClass('showFlag')){.......}else{......}

 同样的道理,也可以判断thisNode的其他内容,例如子元素的个数,text内容等等,这样根据具体需求来说。

 

相关文章:

  • 2021-11-03
  • 2021-08-17
  • 2021-12-23
  • 2021-12-22
  • 2021-11-15
  • 2022-12-23
  • 2021-04-21
猜你喜欢
  • 2021-11-05
  • 2021-11-05
  • 2022-01-16
  • 2022-01-08
  • 2021-11-05
  • 2022-01-04
相关资源
相似解决方案