Tag: wai aria

为jQuery .toggle()方法添加WAI-ARIA支持

我想将WAI-ARIA aria-hidden支持与jQuery的.toggle()方法配对。 所以给定 Hi there $(‘#myElement’).toggle()会隐藏元素,并设置aria-hidden=”true” : Hi there 再次执行相同的$(‘#myElement’).toggle()脚本将显示(切换)元素,并设置(切换) aria-hidden=”false” : Hi there 我可能想要使用该方法的完整function,也许是一些类似的东西 $(‘#myElement’).toggle( if ($this.css(‘display’)===’none’){ $this.prop(‘aria-hidden’, ‘true’) } else { $this.prop(‘aria-hidden’, ‘false’) } ) 扩展.toggle()以切换aria-hidden状态的最高性能解决方案是什么?