Implementation of text box scaling and up-down moving function based on jquery _jquery

Source: Internet
Author: User

Want to make your Web page more cool, want to make your comments more interactive, then please carefully study the next code.

jquery Code:

Copy Code code as follows:

$ (function () {
var $comment = $ (' #comment ');
$ ('. Bigger '). Click (function () {
if (! $comment. Is (": Animated")) {
if ($comment. Height () < 500) {
$comment. Height ($comment. Height () + 50);
$comment. Animate ({height: "+=50"},400);
}
}
});
$ ('. smaller '). Click (function () {
if (! $comment. Is (": Animated")) {
if ($comment. Height () > 50) {
$comment. Height ($comment. Height ()-50);
$comment. Animate ({height: "-=50"},400);
}
}
});
$ ('. up '). Click (function () {
if (! $comment. Is (": Animated")) {
$comment. Animate ({scrolltop: "-=50"},400);
}
});
$ ('. Down '). Click (function () {
if (! $comment. Is (": Animated")) {
$comment. Animate ({scrolltop: "+=50"},400);
}
});
});

HTML code:

Copy Code code as follows:

<div class= "MSG" >
<div class= "Msg_caption" >
<span class= "bigger" > Amplification </span>
<span class= "Smaller" > Shrink </span>
<span class= ' up ' > Up </span>
<span class= "Down" > Downward </span>
</div>
<div>
<textarea id= "comment" rows= "8" cols= ">"
Water, electricity, electricity, toner, safin sofa, relax, relax, sofa.
When the skin water fly sofa hair sofa hair Hair
Water, electricity, electricity, toner, safin sofa, relax, relax, sofa.
When the skin water fly sofa hair sofa hair Hair
</textarea>
</div>
</div>

CSS code:

Copy Code code as follows:

. Bigger,. Down,. Up,. smaller{
Background-color: #f1a55c;
}

Code, how to use, where to use, I do not say more, small partners free play it.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.