Search code examples
jqueryfadein

jQuery Force fadeIn() to use display: block for list items


I am using fadeIn() to fade in some list items. I want them to go from display: none to display: block.

But jQuery applies the style list-item instead of block.

Example here: http://jsfiddle.net/kDCwJ/

Currently I am doing the following to compensate but I think there must be a cleaner way:

$('li').fadeIn().css({ display: 'block' });

Is there a way to force fadeIn() to result in display: block styling for <li> elements?

Thanks!


Solution

  • Not while it's a list-item itself. If you want display:block you can use a div element which will fadeIn to display:block.

    Note that using display:block on your list-item makes some of the list-item properties go away anyway.