2012-10-24 60 views
0

我想製作一個始終適合屏幕100%並與中心對齊的滑塊,無論分辨率如何。我想用縮放屬性來完成它,並通過Javascript進行更改。CSS縮放屬性在FF中的行爲不同

到目前爲止,我這個編碼

CSS:

#wrapper-slider{position:absolute;width:100%;height:100%;top:0;left:0;z-index:7;display:block; -moz-transform: scale(0.3); zoom:30%; -moz-transform-origin:0 0;}  
#container-slider {background:url('http://i48.tinypic.com/znpwm0.jpg') no-repeat; width:967px; height:800px; margin: 0 auto; text-align:center; display: block; position: relative;}  
#wrapper-slider .img {position:absolute;display:black;z-index:8;height:486px;width:758px; padding-left: 101px; padding-top: 94px; margin:0 auto; text-align: center;} 
#wrapper-slider .img img {max-height: 487px; max-width:758px; margin:0 auto; display: block;} 
#container-slider p {position: absolute; z-index: 20; color:#000000;} 
#container-slider strong { line-height: 21px;} 
#container-slider .add-to-basket {left:109px; bottom:24px;} 
#container-slider .add-to-basket a {display: block; width:142px; height:36px; font-size:14px; font-weight:bold; text-align:center; color: black;line-height: 34px;} 
#container-slider .description {right: 112px; bottom:17px; width: 361px; height:76px; text-align:center; font-size:15px;} 
#container-slider .details {right:492px; bottom:17px; width:188px; height:76px; text-align:center; font-size:15px;} 
#container-slider .price {left:109px; bottom:72px; width:142px; text-align:center; font-size:24px; color: #FF6C00;} 
#container-slider .left{left:395px;} 
#container-slider .right{right:401px;} 
#container-slider .arrow{width:80px; height: 80px; display:block; bottom:120px; position:absolute;z-index:10; text-indent: -10000000px;} 
#container-slider .close{width:70px; height: 70px; display:block; top:25px; right:40px; position:absolute;z-index:10; text-indent: -10000000px;} 
#container-black{position:absolute;width:100%;height:100%;top:0;left:0;background:#000;z-index:6;}​ 

HTML:

<div id="wrapper-slider"> 
    <div id="container-slider"> 
     <a class="close" href="#" title="Zamknij podgląd">close</a> 

     <div class="img"> 
      <img class="main" src="http://asset0.cbsistatic.com/cnwk.1d/i/tim/2012/08/15/35414204_620x433.jpg"/> 
     </div> 

     <a class="arrow left" title="Poprzedni produkt" href="#">Left</a> 
     <a class="arrow right" title="Następny produkt" href="#">Right</a> 

     <p class="price">390.00 PLN</p> 
     <p class="add-to-basket"><a href="#">Dodaj do koszyka</a></p> 

     <p class="details"> 
      <strong>Wymiary:</strong><br> 
      100 x 50 cm<br> 
      <strong>Technika:</strong><br> 
      Rysunek 
     </p> 

     <p class="description" title="Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book.  "> 
      <strong>Opis:</strong><br> 
      Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy t...   
     </p>  
    </div> 

</div> 
<div id="container-black"></div> 
​ 

此代碼工作在jsfiddle.net:http://jsfiddle.net/MjmDT/1/

它工作在鉻完美,但在FF和IE中,它與左側對齊。我不知道如何解決它。

+0

你使用的是jquery 1.7 –

+1

我一直以爲'zoom'只是爲了修復IE瀏覽器動作時的東西。 – techfoobar

+0

@NullPointer:在這個例子中,我不使用jquery。你問來幹什麼? @techfoobar:但是'縮放'工作在鉻。在FF我使用不同的屬性。問題在於它以奇怪的方式與左側對齊。 – mario199

回答

0

沒有名爲zoom的CSS屬性。這是CSS的專有MS IE擴展(如hasLayout標誌)。

此外,Firefox允許設置放大的happ3ens:整個頁面應放大,包括任何圖像(默認爲任何當前的瀏覽器版本)。或者在縮放頁面時只應增加文字大小。檢查您的Fx設置:「查看」 - >「縮放」(或類似的,我已安裝德語版本)。

+0

但是可以用css或js來擴展整個網站嗎?其實它的作品,但我不知道爲什麼在ff,即有這種奇怪的對齊左邊。 – mario199

相關問題