jquery随记(效果)-----用回调函数处理单元素和多元素的排队

 

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>无标题文档</title>
<link rel="stylesheet" type="text/css" href="Untitled-2.css" />
<script type="text/javascript" src="jquery-1.6.2.js"></script>
<script type="text/javascript">
$(document).ready(function(){
 //回调函数处理多元素排队
 var $thirdPara=$('p:eq(2)');
 $thirdPara
  .css('border','1px solid red')
  .click(function(){
   $(this).next().slideDown('slow',function(){
    $thirdPara.slideUp('slow');
    });
   });
 $('p:eq(3)').css('background-color','#ccc').hide();
 
 
 //回调函数出来单元素排队
 $('div.label').click(function(){
  var $switcher=$('#switcher').parent();
  $('#switcher')
   .fadeTo('slow',0.5)
   .animate({left:'50%'},'slow')
   .fadeTo('slow',1.0)
   .slideUp('slow',function(){ //用回调函数显示非效果函数的排队
    $('#switcher').css('background-color','red')    
    })
   .slideDown('slow');
  });
 });
</script>
</head>

<body>
    
    <div id="switcher" style="border:1px solid red">
     <div class="label">Text Size </div>
        <button id="switcher-default">Default</button>
        <button id="switcher-larger">Bigger</button>
        <button id="switcher-small">Small</button>
    </div>
    <div class="speech">
     <p class="p1">Fourscore and seven years ago our fathers brought forth
         on this sontinent a new nation,conceived in liberity,
            and dedicated to the proposition that all men are created
            equal.
        </p>
        <p>Now we are engaged in a great civil war,testing whether
            that  nation, or any nation so conceived and so didicated,
            can long endure,We are met on a great battlefield of
            that war, We have come to dedicate a portion of that
            field as a final resting-place for those who here gave
            their lives that the nation might live,it is altogether
            fitting and proper that we should do this .But,in a larger
            sense,we cannot dedicate,we cannont consecrate,
            we cannot ballow,this ground.       
        </p>
        <a href="#" class="more">read more</a>
          <p>The brave men,living and dead,who struggled
                here have consecrated it,far above our poor
                power to add or detract,The world will little
                note,nor long remember,what we say here,but it
                can never forget what they did here.it is for us
                the living,rather,to be dedicated here to the
                unfinished work which they who fought here have
                thus far so nobly advanced
          </p>
          <p>It is rather for us to be here dedicated to the
                 great task remaining before us-that from
                 these honored dead we take increased devotion to
                 that cause for which they gave the last full
                 measure of devotion-that we here highly
                 resolve that these dead shall not have died in
                 vain-that this nation,under God,shall
                 have a new birth of freedom and that government
                 of the people,by the people,for the people,
                 shall not perish from the earth.           
             </p>
    </div>
  </body>
</html>

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

bzuld

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值