JQuery Programmer Question: Download JQuery Programmer PDF

Why is the block display style used for animations?

Tweet Share WhatsApp

Answer:

In html only the block level elements can have custom heights and widths. So when a user defines an animation method for usage such as show, hide, slide up etc the display css property of the block being animated is set to display block style. On completion of the animation the display style of the block would be changed to its original value. This procedure does not work properly for inline elements and the following workarounds can be applied to it:

- If the user wants the element to remain inline and only want to animate it in and out he can use the fadein and fadeout animation instead of using the show method.
- The user can also use a block level element with float to make the element appear inline with the rest of the content around it.

Download JQuery Programmer PDF Read All 201 JQuery Programmer Questions
Previous QuestionNext Question
Is it possible to get value of multiple CSS properties in single statement?Does jQuery 2.0 supports IE?