jquery methods(chapter 4)

[b].css()[/b]
• .css('property','value')
• .css({property1: 'value1', 'property-2': 'value2'})

[quote]Numeric values do not take quotation marks while string values do.
But, when using the map notation, quotation marks are not required for
property names if they are written in camel-cased DOM notation.
[/quote]
[b].hide() .show() .animate[/b]
Basic .hide() and .show(), without any parameters, can be thought of as smart shorthand methods for .css('display','string'), where string is the
appropriate display value. The effect, as might be expected, is that the matched set of elements will be immediately hidden or shown, with no animation. The .hide() method sets the inline style attribute of the matched set of elements to display:none. The smart part here is that it remembers the value of the display property—typically block or inline—before it was changed to none. Conversely, the .show() method restores the matched set of elements to whatever visible display property they had before display:none was applied.
[b]antimate()[/b]
However, jQuery also provides a powerful animate() method that allows us to create our own custom animations with multiple effects. The animate method takes four arguments:
1. A map of style properties and values—similar to the .css() map discussed
earlier in this chapter
2. An optional speed—which can be one of the preset strings or a number
of milliseconds
3. An optional easing type—an advanced option discussed in Chapter 10
4. An optional callback function—which will be discussed later in this chapter
All together, the three arguments would look like this:
  .animate({param1: 'value1', param2: 'value2'}, speed, function() {
alert('The animation is finished.');
});


Remember that .show('slow') simultaneously modifies the width, height, andopacity. In fact, this method is really just a shortcut for the .animate() method, with a specific set of built-in style properties.
.show('slow');
. animate({height: 'show', width: 'show',
opacity: 'show'}, 'slow');
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值