2011-03-16 55 views
2

我有一個頁面設置與使用jQuery顯示()和隱藏()函數到柱滑入和滑出隱藏列。更平滑的替代jQuery的顯示()和隱藏()

但是它是一種「笨重」,不看顯示/隱藏時非常流暢;相反,我也有一段使用jQuery UI手風琴的頁面。當這些部分的過渡看起來非常漂亮和流暢切換...

難道還有比顯示()/隱藏(),它看起來像你一樣的手風琴沒有一個更好的功能? (也許是「寬鬆」的參數可以在顯示/隱藏功能可以使用,但我不知道如何正確使用它?)

+0

你是動畫表行嗎? – rahul 2011-03-16 15:54:38

+0

您還可以嘗試'animate'將寬度更改爲'0px'以隱藏並顯示'100%'之類的內容。 – 2011-03-16 15:56:40

回答

5

我猜你會想用jQuery.fadeInjQuery.fadeOut

+0

或者可能slideIn/slideOut。 :) – 2011-03-16 15:54:05

+0

感謝您的回覆,但不是將列滑入/退出生存能力,fadeIn/fadeOut函數突然將列寬跳到100%,然後淡入,這不是我要找的。 – 2011-03-17 00:34:25

1

也期待在jQuery.slideToggle

+0

謝謝,我已經試過了,但是slideToggle也是顯示/隱藏功能的矮胖/跳躍。 – 2011-03-17 00:35:03

0

我不是JQuery的UI動畫的忠實粉絲。當我嘗試動畫我的show()/ hide()時,我遇到了同樣的問題...結果是波濤洶涌。我最終爲我的大部分動畫使用了Scriptaculous,因爲它提供了比JQuery UI提供的更流暢的動畫和更多的配置。 Scriptaculous可以完成JQuery提供的功能,還有更多功能。

0

你可以使用淡出()淡入()或了slideDown效果基本show。製作時間是 「慢」 或者時間

欲瞭解更多信息:Sliding effect

這裏是利用動畫()的另一種方式 http://www.vietanime.net/

的代碼示例在這裏:

// SLIDE FOOTER MENU 
    $('#footer-menu > li').hover(
     function() { 
      var $this = $(this); 
      $('a',$this).stop(true,true).animate({ 
        'bottom':'-45px' 
       }, 300); 
      $('i',$this).stop(true,true).animate({ 
        'top':'-10px' 
       }, 700); 
     }, 
     function() { 
      var $this = $(this); 
      $('a',$this).stop(true,true).animate({ 
        'bottom':'-145px' 
       }, 300); 
      $('i',$this).stop(true,true).animate({ 
        'top':'50px' 
       }, 400); 
     } 
    ); 

和HTML瀏覽:

<div id="bottom-slide-out-menu"> 

        <ul id="footer-menu"> 
          <li> 
            <a> 
              <i class="icon_about"></i> 
              <span class="title">Search</span> 
              <span class="description">Direct link, Mp3, Music, Video, Tutorials</span> 
            </a> 
          </li> 
          <li> 
            <a> 
              <i class="icon_work"></i> 
              <span class="title">Listen</span> 
              <span class="description">Mp3</span> 
            </a> 
          </li> 
          <li> 
            <a href="archive.php"> 
              <i class="icon_help"></i> 
              <span class="title">Archive</span> 
              <span class="description">Direct Links Archive</span> 
            </a> 
          </li> 
          <li> 
            <a href="search.php"> 
              <i class="icon_search"></i> 
              <span class="title">Developer</span> 
              <span class="description">Keywords, SEO, Website </span> 
            </a> 
          </li> 
        </ul> 
      </div> 

和一些小css你可以使它美麗:

ul#footer-menu{ 

          list-style:none; 
          position:absolute; 
          bottom:0px; 
          left:20px; 
          font-size:36px; 
          font-family: Helvetica, Arial, sans-serif; 
          font-weight: bold; 
          color:#999; 
          letter-spacing:-2px; 
        } 
        ul#footer-menu li{ 
          float:left; 
          margin:0px 10px 0px 0px; 
        } 
        ul#footer-menu a{ 
          cursor:pointer; 
          position:relative; 
          float:left; 
          bottom:-145px; 
          line-height:20px; 
          width:210px; 
        } 
        ul#footer-menu a:hover{ 
          text-decoration: none; 
        }