(, CSS , ). , , HTML- .
, .
jsFiddle
...
, :
$('.feature_box').showFeatureText();
showFeatureText $('.feature_box'), , this insde showFeatureText, this feature_box. DIV . .
`showFeatureText. jQuery. jQuery:
$.fn.showFeatureText = function() {
return this.each(function(){
var box = $(this);
var text = $('p',this);
text.css({ position: 'absolute', top: '57px' }).hide();
box.hover(function(){
text.slideDown("fast");
},function(){
text.slideUp("fast");
});
});
}
, return this.each(function(){...}) , jQuery. jQuery DIV feature_box, , , jQuery, , return this.each(). , , , .showFeatureText $('.feature_box'). , .
var box = $(this);
var text = $('p',this);
. box $(this), <div class="feature_box">. box.
- div. , ('p', this) this, this - feature_box div. jQuery. , : $(this, that). , id a id b $("#a, #b"), . .
, box div .feature_box, text .
:
text.css({ position: 'absolute', top: '57px' }).hide();
feature_box div . text - . .css() CSS. . , hide() . CSS . .
, , , div. , , , this, $('.feature_box'), div .feature_box, . , :
box.hover(function(){
text.slideDown("fast");
},function(){
text.slideUp("fast");
});
, hover() 2 . - , , box. - , , . div, text . , .
. jQuery .
each jsFiddle. , .
:
jQuery
.hide()
.hover()
.slideDown()
.slideUp()
.each()
jQuery