2013-01-09 59 views
1

我與我的多個nivo滑塊的定位戰鬥。我有(現在)五個滑塊應該出現在同一個位置,which can be seen here多個Nivo滑塊 - 定位不明確

問題在於代碼中的定位總是相同的;但它不在瀏覽器的顯示器上。當點擊「保持跟蹤」或「化學廢料」時,滑塊會出現在頁面的頂部,或者只是部分顯示。

<div style="margin-left: 10px"> 
    <div id="pagewrap"> 
     <div class="slidewrap"> 
      <div id="slider1"> 
       <a class="lightview" href="images/geg_fish_stocks.png"><img alt="Gallery Picture" title="#caption2" src="images/geg_fish_stocks_light.png" /></a> 
       <a class="lightview" href="images/geg_protected_areas.png"><img alt="Gallery Picture" title="#caption6" src="images/geg_protected_areas_light.png" /></a> 
      </div> 
      <div id="slider2" style="margin-top: -350px; visibility: hidden"> <!-- Atmosphere --> 
       <a class="lightview" href="images/geg_temperature.png"><img alt="Gallery Picture" title="#caption4" src="images/geg_temperature_light.png" /></a> 
       <a class="lightview" href="images/geg_indoor_cooking.png"><img alt="Gallery Picture" title="#caption17" src="images/geg_indoor_cooking_light.png" /></a> 
      </div> 
      <div id="slider3" style="margin-top: -350px; visibility: hidden"> <!-- Biodiversity --> 
       <a class="lightview" href="images/geg_protected_areas.png"><img alt="Gallery Picture" title="#caption6" src="images/geg_protected_areas_light.png" /></a> 
       <a class="lightview" href="images/geg_access_benefit.png"><img alt="Gallery Picture" title="#caption7" src="images/geg_access_benefit_light.png" /></a> 
      </div> 
      <div id="slider4" style="margin-top: -350px; visibility: hidden"> <!-- Chemicals --> 
       <a class="lightview" href="images/geg_radioactive_waste.png"><img alt="Gallery Picture" title="#caption13" src="images/geg_radioactive_waste_light.png" /></a> 
       <a class="lightview" href="images/geg_basel_convention.png"><img alt="Gallery Picture" title="#caption14" src="images/geg_basel_convention_light.png" /></a> 
      </div> 
      <div id="slider5" style="margin-top: -350px; visibility: hidden"> <!-- Keeping Track --> 
       <a class="lightview" href="images/kt_hdi.png"><img alt="Gallery Picture" title="#caption9" src="images/kt_hdi_light.png" /></a> 
       <a class="lightview" href="images/kt_food_supply.png"><img alt="Gallery Picture" title="#caption10" src="images/kt_food_supply_light.png" /></a> 
      </div> 

的CSS是這樣的:

#slidewrap{ 
    position:absolute; 
    background: #fff; 
}  

#slider, #slider1, #slider2, #slider3, #slider4, #slider5 { 
    position:relative; 
    height:auto; 
    width:915px; 
    border:10px solid rgba(89,117,220,0.33); 
    box-shadow:0 0 5px #444; 
    margin: 0; 
} 
#slider img, #slider1 img, #slider2 img, #slider3 img, #slider4 img, #slider5 img{ 
    position:absolute; 
    top:20px; 
    left:0px; 
    display:none; 
} 

我真的迷茫了,不知道爲什麼會。感謝任何可以幫助我解決這個謎題的提示。

插件激活:

$(window).load(function() 
{ 
    $('#slider1').nivoSlider({ 
     pauseTime: 4000 
    }); 
    $('#slider2').nivoSlider({ 
     pauseTime: 4000 
    }); 
    $('#slider3').nivoSlider({ 
     pauseTime: 4000 
    }); 
    $('#slider4').nivoSlider({ 
     pauseTime: 4000 
    }); 
    $('#slider5').nivoSlider({ 
     pauseTime: 4000 
    }); 
    $('#slider6').nivoSlider({ 
     pauseTime: 4000 
    }); 
    $('#slider7').nivoSlider({ 
     pauseTime: 4000 
    }); 
});  
+0

將插件應用於滑塊的JS代碼示例會很有幫助。 – Boaz

+0

添加了插件激活。這有幫助嗎? – luftikus143

+0

我認爲它至少部分是一個CSS事物。對於DIV來說,「style =」margin-top:-350px;「似乎對我來說並不一致,我認爲$ sliderX的位置應該是絕對的;我測試過它,但沒有任何變化...... – luftikus143

回答

0

好,這裏是解決方案。問題出在CSS「height:auto」。當我拿走它並用330px代替時,它效果非常好!