jQuery in Action

136
CHAPTER 5
Sprucing up with animations and effects
Command syntax: hide
hide(speed,callback)
Causes the elements in the wrapped set to become hidden. If called with no parameters, the
operation takes place instantaneously by setting the display style property value of the ele-
ments to none. If a speed parameter is provided, the elements are hidden over a period of
time by adjusting their size and opacity downward to zero, at which time their display style
property value is set to none to remove them from the display.
An optional callback can be specified that's invoked when the animation is complete.
Parameters
speed
(Number|String) Optionally specifies the duration of the effect as a number of
milliseconds or as one of the predefined strings: slow, normal, or fast. If omit-
ted, no animation takes place, and the elements are immediately removed
from the display.
callback
(Function) An optional function invoked when the animation completes. No
parameters are passed to this function, but the function context (this) is set
to the element that was animated.
Returns
The wrapped set.
Command syntax: show
show(speed,callback)
Causes any hidden elements in the wrapped set to be revealed. If called with no parameters,
the operation takes place instantaneously by setting the display style property value of the
elements to their previous setting (such as block or inline) if the element was hidden via a
jQuery effect. If the element was not hidden via jQuery, the display style property value
defaults to block.
If a speed parameter is provided, the elements are revealed over a specified duration by
adjusting their size and opacity upward.
An optional callback can be specified that's invoked when the animation is complete.
Parameters
speed
(Number|String) Optionally specifies the duration of the effect as a number of
milliseconds or as one of the predefined strings: slow, normal, or fast. If omit-
ted, no animation takes place and the elements are immediately revealed in
the display.
callback
(Function) An optional function invoked when the animation is complete. No
parameters are passed to this function, but the function context (this) is set
to the element that was animated.
Returns
The wrapped set.


Другие страницы

 
Cкачать книги бесплатно без регистрации в электронном виде (pdf, chm, txt).Вы можете читать книги онлайн на нашем сайте литературного портала книг.Большая подборка учебников, пособий, интересных книг.Электронные книги на английском языке скачать бесплатно без смс.