1. <tt id="5hhch"><source id="5hhch"></source></tt>
    1. <xmp id="5hhch"></xmp>

  2. <xmp id="5hhch"><rt id="5hhch"></rt></xmp>

    <rp id="5hhch"></rp>
        <dfn id="5hhch"></dfn>

      1. 顯示jquery代碼的四種方式

        時(shí)間:2020-11-09 18:20:33 jQuery Mobile 我要投稿

        顯示jquery代碼的四種方式

          第一種實(shí)現(xiàn)方式:

          代碼如下:

          1. <script type="text/javascript">

          $(function(){

          $(".topicList h3").click(function(){

          var UL = $(this).next("ul");

          if(UL.css("display")=="none"){

          UL.css("display","block");

          }

          else{

          UL.css("display","none");

          }

          });

          });

          </script>

          第二種實(shí)現(xiàn)方式:

          代碼如下:

          2. <script type="text/javascript">

          $(function(){

          $(".topicList h3").toggle(function(){

          $(this).next("ul").hide(1000);

          },function(){

          $(this).next("ul").show(1000);

          });

          });

          </script>

          第三種實(shí)現(xiàn)方式:

          可以使用Jquery提供的'show和hide來(lái)完成帶緩動(dòng)的顯示和隱藏效果,由于兩個(gè)方法相似,可以直接使用toggle來(lái)完成。

          代碼如下:

          3. <script type="text/javascript">

          $(function(){

          $(".topicList h3").toggle(function(){

          $(this).next("ul").css("display","none");

          },function(){

          $(this).next("ul").css("display","block");

          });

          });

          </script>

          第四種實(shí)現(xiàn)方式:

          toggle如果有兩個(gè)參數(shù),并且都是函數(shù),表示第一次點(diǎn)擊執(zhí)行第一個(gè)函數(shù),第二次點(diǎn)擊執(zhí)行第二個(gè)函數(shù)。

          代碼如下:

          4. <script type="text/javascript">

          $(function(){

          $(".topicList h3").toggle(topicHandler,topicHandler);

          function topicHandler(){

          //使用fadeIn、show、slideDown可以完成某個(gè)容器的顯示

          //使用fadeOut、hide、slideUp可以完成某個(gè)容器的隱藏

          //所以可以通過(guò)各個(gè)的toggle來(lái)完成兩個(gè)之間的輪換

          $(this).next("ul").toggle(1000);

          }

          });

          </script>

        【顯示jquery代碼的四種方式】相關(guān)文章:

        1.關(guān)于jQuery Ajax 異步加載顯示等待效果代碼分享

        2.jquery提交按鈕的代碼

        3.jquery異步請(qǐng)求的實(shí)例代碼

        4.jQuery遍歷Form示例代碼

        5.分享jquery uaMatch源代碼

        6.基于jQuery的固定表格頭部的代碼

        7.關(guān)于jQuery實(shí)現(xiàn)高亮顯示的方法介紹

        8.jquery顯示和隱藏div特效的實(shí)例

        国产高潮无套免费视频_久久九九兔免费精品6_99精品热6080YY久久_国产91久久久久久无码

        1. <tt id="5hhch"><source id="5hhch"></source></tt>
          1. <xmp id="5hhch"></xmp>

        2. <xmp id="5hhch"><rt id="5hhch"></rt></xmp>

          <rp id="5hhch"></rp>
              <dfn id="5hhch"></dfn>