slideToggle and :visible

允我心安 提交于 2019-11-29 05:47:04

Your first (non-working) code fragment will be testing :visible while slideToggle is mid-transition (more precisely, it tests it just after the transition starts.) Regardless of whether you're opening or closing, the mid-transition state will be :visible - so you always get true.

Try checking .is(":visible") before calling slideToggle

Try adding a handler.

notes.slideToggle ("fast", function() { 
  var isVisible = notes.is(":visible");
});
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!