2012-01-30 104 views
0

無法得到這個工作在IE瀏覽器,但作品完美的Firefox,這是由於我寫我的CSS的方式嗎?css懸停在IE 8中

感謝

[R

CSS

.theme-default .nivo-directionNav a { 
    display:block; 
    width:26px; 
    height:23px; 
    background: url(../images/arrows-3.png) no-repeat; 
    text-indent:-9999px; 
    border:0; 
} 

.theme-default .nivo-directionNav a:hover { 
    display:block; 
    width:26px; 
    height:23px; 
    background: url(../images/arrows-over-1.png) no-repeat; 
    text-indent:-9999px; 
    border:0; 
} 

的Javascript

//Add Direction nav 
if(settings.directionNav){ 
    slider.append(
     '<div class="nivo-directionNav"> 
      <a class="nivo-prevNav">'+ settings.prevText +'</a> 
      <a class="nivo-nextNav">'+ settings.nextText +'</a> 
     </div>' 
    ); 
    //Hide Direction nav 
    if(settings.directionNavHide){ 
     $('.nivo-directionNav', slider).hide(); 
     slider.hover(function(){ 
      $('.nivo-directionNav', slider).show(); 
     }, 
     function(){ 
      $('.nivo-directionNav', slider).hide(); 
     }); 
    } 
+1

發佈您的HTML標記。說明它現在如何顯示以及它應該如何顯示。此外,刪除'在此處輸入代碼' – Jawad 2012-01-30 10:50:35

+4

您不必重複自己,您的':hover'規則只需要更改後的背景,剩下的將從您先前的規則中應用。 – MMM 2012-01-30 10:55:10

+0

嗨這適用於Javascript代碼,所以它不在HTML – Rifki 2012-01-30 10:57:15

回答

0

沒有理由這不應該在IE 8,也許你的圖像路徑工作 是不正確的。 另外你不需要重複porperties:徘徊becouse一切都是從一個標籤。

嘗試backgroundcolor,我認爲它會工作。搞清楚你的​​問題與背景圖像,如果這個工程(上懸停狀態紅色背景色):

.theme-default .nivo-directionNav a { 
    display:block; 
    width:26px; 
    height:23px; 
    background: url(../images/arrows-3.png) no-repeat; 
    text-indent:-9999px; 
    border:0; 
} 

.theme-default .nivo-directionNav a:hover { 
    background: url(../images/arrows-over-1.png) no-repeat 0 0 #FF0000; 
} 
2

對於超出人的理解IE8的原因(可能是IE也與其他版本)不適用:hover狀態,除非一個鏈接有一個關聯的href屬性。

這可以通過更換得到糾正:

//Add Direction nav 
if(settings.directionNav){ 
    slider.append(
     '<div class="nivo-directionNav"> 
      <a class="nivo-prevNav">'+ settings.prevText +'</a> 
      <a class="nivo-nextNav">'+ settings.nextText +'</a> 
     </div>' 
    ); 
    //Hide Direction nav 
    if(settings.directionNavHide){ 
     $('.nivo-directionNav', slider).hide(); 
     slider.hover(function(){ 
      $('.nivo-directionNav', slider).show(); 
     }, 
     function(){ 
      $('.nivo-directionNav', slider).hide(); 
     }); 
} 

//Add Direction nav 
if(settings.directionNav){ 
    slider.append(
     '<div class="nivo-directionNav"> 
      <a class="nivo-prevNav" href="#">'+ settings.prevText +'</a> 
      <a class="nivo-nextNav" href="#">'+ settings.nextText +'</a> 
     </div>' 
    ); 
    //Hide Direction nav 
    if(settings.directionNavHide){ 
     $('.nivo-directionNav', slider).hide(); 
     slider.hover(function(){ 
      $('.nivo-directionNav', slider).show(); 
     }, 
     function(){ 
      $('.nivo-directionNav', slider).hide(); 
     }); 
    } 
+0

同意,這可能是原因。 – 2013-07-19 08:41:11

0

對於IE6最好的設計以9必須低於使用JavaScript庫。只是調用這些js只休息會做js。