Rumah > hujung hadapan web > tutorial js > Melaksanakan penskalaan kotak teks dan fungsi pergerakan naik dan turun berdasarkan jQuery_jquery

Melaksanakan penskalaan kotak teks dan fungsi pergerakan naik dan turun berdasarkan jQuery_jquery

WBOY
Lepaskan: 2016-05-16 16:30:29
asal
1760 orang telah melayarinya

Jika anda ingin menjadikan halaman web anda lebih keren dan menjadikan ulasan anda lebih interaktif, sila kaji kod ini dengan teliti.

Kod jQuery:

Salin kod Kod adalah seperti berikut:

$(function(){
          var $comment = $('#comment');               $('.bigger').klik(function(){
Jika(!$comment.is(":animasi")){
If($comment.height() < 500){
//$comment.height($comment.height() 50); $comment.animate({ketinggian:" =50"},400);                                                                                                                                                                                                                                                                                                                                                      });
                $('.smaller').klik(function(){
Jika(!$comment.is(":animasi")){
If($comment.height() > 50){
//$comment.height($comment.height() - 50); $comment.animate({ketinggian:"-=50"},400);                                                                                                                                                                                                                                                                                                                                         });
                $('.up').klik(function(){
Jika(!$comment.is(":animasi")){
$comment.animate({scrollTop:"-=50"},400);                                                                                                   });
                $('.down').klik(function(){
Jika(!$comment.is(":animasi")){
                               $comment.animate({scrollTop:" =50"},400);                                                                                                 });
        }); 



Kod HTML:





Salin kod


Kod adalah seperti berikut:


        
& Lt; kelas span = "lebih besar" & gt; & Lt; kelas span = "lebih kecil" & gt; & Lt; kelas span = "naik" & gt;                                                                                                                                                                                                                                   …