2011-06-17 71 views

回答

5

添加position:relative;到你的CSS:

.anim_queue_example1 a 
{ 

    margin: 15px; 
    width: 50%; 
    height: 25px; 
    display: -webkit-box; 
    display: -moz-box; 
    display: box; 
    -webkit-box-align: center; 
    -moz-box-align: center; 
    box-align: center; 

    text-decoration: none; 

    font-size: 15px; 
    font-weight: 700; 

    background: #333; 
    color: #fff; 
    position:relative; 

} 

示例:http://jsfiddle.net/niklasvh/pJMva/10/

+0

嘿尼克拉斯所以這是唯一的問題 的位置是:相對的; 非常感謝我真的很喜歡它我希望我可以不止一次地upvote ... – koool 2011-06-17 11:49:48

2

這將起作用。

$(document).ready(function() { 
    $('ul.anim_queue_example1 a') 
    .hover(function() { 
      $(this).animate({ 
       opacity: 0.25, 
       left: '+=20', 
       height: 'toggle' 
      }, 5000, function() { 
      // Animation complete. 
      }); 
    }, function() { 
      $(this).animate({ 
      opacity: 0.25, 
      left: '+=0', 
      height: 'toggle' 
      }, 5000, function() { 
      // Animation complete. 
     }); 
    }); 

}); 

檢查這裏的工作示例http://jsfiddle.net/pJMva/23/