Toggle CSS3 fade?
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 由 翻译 强力驱动 问题: Is it possible to use jQuery to toggle the opacity of an element (so that you can fade it in/out by the means of -webkit-transition:opacity .5s linear; ) and then change the display to display:block if the element is shown, or display:none if the element is hidden? For example: You click on an <a> tag, which shows a div by means of setting it's opacity to 1 and setting display:block . Then you click the <a> tag again, and it sets the opacity to 0 and then sets the display to none . My attempt at this is below: . visible { opacity :