I would like to share with you a piece of code that is very practical and often used in projects. This Code is based on jQuery to implement the text box zoom and move up and down functions, for more information, see the following code. Would you like to make your webpage more cool and make your comments more interactive? Please study this code carefully.
JQuery code:
The Code is 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 );
}
});
$ ('. Low'). click (function (){
If (! $ Comment. is (": animated ")){
$ Comment. animate ({scrollTop: "+ = 50"}, 400 );
}
});
});
HTML code:
The Code is as follows:
Zoom in
Zoom out
Up
Down
<Br/> water, electricity, water, power, toner, France, sfafen sofa, relax, relax, and relax sofa <br/> water, electricity, water, electricity, and toner sofa, fa, Fa when a sofa Fa <br/>
CSS code:
The Code is as follows:
. Bigger,. down,. up,. smaller {
Background-color: # f1a55c;
}
The code is provided. I will not say much about how to use it and where it is used. Let's make full use of it.