2012-11-28 122 views
2

我在我的網站上有一個垂直的javascript選框(http://blogandthecity.net)。我希望它卡在屏幕上。我認爲它被稱爲「固定」。現在,選取框停在某個點,但我希望它是整個屏幕/網站的大小。如何增加一個javascript選框到網站的大小?

我認爲有兩個選項: 使選取框儘可能長的時間(但某些網頁比一般人長,我不知道我怎樣才能使選取框長,我已經嘗試了一些東西) 2.使位置固定。 (我試圖在代碼中放置「position:fixed」,但結果是選框不再滾動,所以移動停止了,並且選框不適合屏幕)

Do你知道我該如何解決這個問題?如果你需要CSS樣式,我也會把它放在這裏。

下面的代碼(I排除的文本部分):

<script type="text/javascript" src="http://blogandthecity.net/js/marquee-packed.js" ></script> 
    <script type="text/javascript"> 
    //create instance and call method horizontal for horizontal scrolling 
    var horizontal = new marquee("marquee").horizontal( 
    { 
    step:1, //how many pixels to move per interval (default: 1) 
    interval: 40, //how often to move pixels in miliseconds (default: 10) 
    stop_on_hover: true, //should marquee stop on mouse hover (default: true) 
    backwards: false, //rotate elements in opposite direction 
}); 

<script type="text/javascript"> 
    //create instance and call method horizontal for horizontal scrolling 
    var horizontal = new marquee("marquee2").horizontal( 
{ 
    step:1, //how many pixels to move per interval (default: 1) 
    interval: 40, //how often to move pixels in miliseconds (default: 10) 
    stop_on_hover: true, //should marquee stop on mouse hover (default: true) 
    backwards: false, //rotate elements in opposite direction 
}); 

+2

一個選取框?我似乎以某種方式回到了時間... http://www.w3.org/TR/WCAG20/#time-limits – jbabey

+0

有沒有新的方法? – user1861212

+0

不應該使用Marquees,它們違背了W3C的可訪問性準則(參見上面評論中的鏈接)。 – jbabey

回答

0

它被稱爲位置是:固定;在css下面,您的標籤向下滾動並全屏顯示。你可能需要去jQuery,因爲它們是內聯樣式的(或者修改html)?

#marquee, #marquee2 { 
position:fixed; 
} 

#marquee { 
margin-top:140px; 
} 

#marquee2 { 
margin-left:-520px; 
}