2011-01-14 17 views
1

我有一個div,當用戶將鼠標懸停在鏈接上時,使用jquery下拉菜單。該div的CSS是在這裏:在鉻中的位置問題

.mask-layer { 
    height: 0; 
    overflow: visible; 
    position: relative; 
    top: 54px; 
    float: right; 
    z-index: 1000; 
} 
.slidedown { 
    height: auto; 
    width: 300px; 
    background: url(../images/bg_shopping_bag_span.png); background-repeat:repeat-y; 
    color: white; 
} 

Html只是在蒙版圖層div內滑動div。出於某種原因,我無法在此發佈任何尖括號以向您展示。

最後jQuery的:

jQuery(document).ready(function() { 
    jQuery('.slidedown').hide(); 
    jQuery('a.top-link-cart').hover(function() { 
     jQuery('.slidedown').stop(true, true).animate({ 
      height: ['toggle', 'swing'], 
     }, 600, function() {}); 
    }, function() { 
     jQuery('.slidedown').mouseout(function() { 
      setTimeout(function() { 
       jQuery('.slidedown').stop(true, true).animate({ 
        height: '0px' 
       }, 600, function() {}); 
      }, 200); 
     }); 
    }); 
}); 

下拉在Internet Explorer和Firefox效果很好。但是,在Chrome中,下滑div出現在頁面上的錯誤位置。它出現在屏幕邊緣的所有其他div上。有沒有辦法來解決這個問題?我應該提及,當我禁用jquery,以便div不隱藏並且不動畫時,即使在chrome中它也處於正確的位置。所以也許這是jQuery的問題?感謝您的任何建議。

+0

如何重現bug的鏈接?一個活頁面或類似http://jsfiddle.net會很有幫助。 – 2011-01-14 16:39:52

回答

0

如果您從.mask-layer中刪除float: right,它會工作嗎?

如果是的話,可以嘗試在clear: both.slidedown

+0

刪除浮動:正確並添加清除:兩者都是改進。現在div滑落,但在頁面的最左側(在父應用程序中,它應該是這樣),這很好。我應該如何定位.mask層如果我不能使用float:對嗎?也許在mask div中使用絕對位置?它需要放在父div的最右側。 :) – user1448260 2011-01-14 16:50:33