返回列表 發帖
我是小包
我又來發問了
算是一個CSS的問題
Lytebox的確蠻好用的
我也用過另外一種叫做litebox
就是您指的那個啦
http://www.doknowevil.net/litebox/

但兩者執行時--相片框都會預設在中間的位置--
請問要怎麼改成靠右或靠左的位置呢??
我嘗試過改過CSS
使用過margin設定text-align設定
都沒辦法使它改變對齊方向^^|||

[ 本帖最後由 bau720123 於 2009-4-14 19:09 編輯 ]
邁向神乎其技的境界^^

TOP

感謝您的指導
更改之後果然出現位置以靠右顯示了
CSS碼如下~分享給需要的人~其中紅色字體的部分是照您說的改的

litebox版本
#lightbox{        position: absolute;        left: 0; width: 100%; z-index: 100; text-align: center; line-height: 0;}
#lightbox img{ width: auto; height: auto;}
#lightbox a img{ border: none; }

#outerImageContainer{ position: absolute; background-color: #fff; width: 250px; height: 250px; margin: 0; right:0; }

#imageContainer{ padding: 10px; }

#loading{ position: absolute; top: 40%; left: 0%; height: 25%; width: 100%; text-align: center; line-height: 0; }
#hoverNav{ position: absolute; top: 0; left: 0; height: 100%; width: 100%; z-index: 10; }
#imageContainer>#hoverNav{ left: 0;}
#hoverNav a{ outline: none;}

#prevLink, #nextLink{ width: 49%; height: 100%; background-image: url(data:image/gif;base64,AAAA); /* Trick IE into showing hover */ display: block; }
#prevLink { left: 0; float: left;}
#nextLink { right: 0; float: right;}
#prevLink:hover, #prevLink:visited:hover { background: url(../images/prevlabel.gif) left 15% no-repeat; }
#nextLink:hover, #nextLink:visited:hover { background: url(../images/nextlabel.gif) right 15% no-repeat; }

#imageDataContainer{ position: absolute;font: 10px Verdana, Helvetica, sans-serif; background-color: #fff; margin: 0; line-height: 1.4em; overflow: auto; width: 100%; right:0; }

#imageData{        padding:0 10px; color: #666; }
#imageData #imageDetails{ width: 70%; float: left; text-align: left; }       
#imageData #caption{ font-weight: bold;        }
#imageData #numberDisplay{ display: block; clear: left; padding-bottom: 1.0em;        }                       
#imageData #bottomNavClose{ width: 66px; float: right;  padding-bottom: 0.7em; outline: none;}                

#overlay{ position: absolute; top: 0; left: 0; z-index: 90; width: 100%; height: 500px; background-color: #000; }

lytebox版本
#lbOverlay { position: fixed; top: 0; left: 0; z-index: 99998; width: 100%; height: 500px;}
        #lbOverlay.grey { background-color: #000000; }
        #lbOverlay.red { background-color: #330000; }
        #lbOverlay.green { background-color: #003300; }
        #lbOverlay.blue { background-color: #011D50; }
        #lbOverlay.gold { background-color: #666600; }

#lbMain { position: absolute; left: 0; width: 100%; z-index: 99999; text-align: center; line-height: 0; }
#lbMain a img { border: none; }

#lbOuterContainer { position: absolute; background-color: #fff; width: 250px; height: 250px; margin: 0; right:0; }
        #lbOuterContainer.grey { border: 3px solid #888888; }
        #lbOuterContainer.red { border: 3px solid #DD0000; }
        #lbOuterContainer.green { border: 3px solid #00B000; }
        #lbOuterContainer.blue { border: 3px solid #5F89D8; }
        #lbOuterContainer.gold { border: 3px solid #B0B000; }

#lbDetailsContainer {        position: absolute;font: 10px Verdana, Helvetica, sans-serif; background-color: #fff; width: 100%; line-height: 1.4em;        overflow: auto; margin:0; right:0; }
        #lbDetailsContainer.grey { border: 3px solid #888888; border-top: none; }
        #lbDetailsContainer.red { border: 3px solid #DD0000; border-top: none; }
        #lbDetailsContainer.green { border: 3px solid #00B000; border-top: none; }
        #lbDetailsContainer.blue { border: 3px solid #5F89D8; border-top: none; }
        #lbDetailsContainer.gold { border: 3px solid #B0B000; border-top: none; }

#lbImageContainer, #lbIframeContainer { padding: 10px; }
#lbLoading {
        position: absolute; top: 45%; left: 0%; height: 32px; width: 100%; text-align: center; line-height: 0; background: url(images/loading.gif) center no-repeat;
}

#lbHoverNav { position: absolute; top: 0; left: 0; height: 100%; width: 100%; z-index: 10; }
#lbImageContainer>#lbHoverNav { left: 0; }
#lbHoverNav a { outline: none; }

#lbPrev { width: 49%; height: 100%; background: transparent url(images/blank.gif) no-repeat; display: block; left: 0; float: left; }
        #lbPrev.grey:hover, #lbPrev.grey:visited:hover { background: url(images/prev_grey.gif) left 15% no-repeat; }
        #lbPrev.red:hover, #lbPrev.red:visited:hover { background: url(images/prev_red.gif) left 15% no-repeat; }
        #lbPrev.green:hover, #lbPrev.green:visited:hover { background: url(images/prev_green.gif) left 15% no-repeat; }
        #lbPrev.blue:hover, #lbPrev.blue:visited:hover { background: url(images/prev_blue.gif) left 15% no-repeat; }
        #lbPrev.gold:hover, #lbPrev.gold:visited:hover { background: url(images/prev_gold.gif) left 15% no-repeat; }
       
#lbNext { width: 49%; height: 100%; background: transparent url(images/blank.gif) no-repeat; display: block; right: 0; float: right; }
        #lbNext.grey:hover, #lbNext.grey:visited:hover { background: url(images/next_grey.gif) right 15% no-repeat; }
        #lbNext.red:hover, #lbNext.red:visited:hover { background: url(images/next_red.gif) right 15% no-repeat; }
        #lbNext.green:hover, #lbNext.green:visited:hover { background: url(images/next_green.gif) right 15% no-repeat; }
        #lbNext.blue:hover, #lbNext.blue:visited:hover { background: url(images/next_blue.gif) right 15% no-repeat; }
        #lbNext.gold:hover, #lbNext.gold:visited:hover { background: url(images/next_gold.gif) right 15% no-repeat; }

#lbPrev2, #lbNext2 { text-decoration: none; font-weight: bold; }
        #lbPrev2.grey, #lbNext2.grey, #lbSpacer.grey { color: #333333; }
        #lbPrev2.red, #lbNext2.red, #lbSpacer.red { color: #620000; }
        #lbPrev2.green, #lbNext2.green, #lbSpacer.green { color: #003300; }
        #lbPrev2.blue, #lbNext2.blue, #lbSpacer.blue { color: #01379E; }
        #lbPrev2.gold, #lbNext2.gold, #lbSpacer.gold { color: #666600; }
       
#lbPrev2_Off, #lbNext2_Off { font-weight: bold; }
        #lbPrev2_Off.grey, #lbNext2_Off.grey { color: #CCCCCC; }
        #lbPrev2_Off.red, #lbNext2_Off.red { color: #FFCCCC; }
        #lbPrev2_Off.green, #lbNext2_Off.green { color: #82FF82; }
        #lbPrev2_Off.blue, #lbNext2_Off.blue { color: #B7CAEE; }
        #lbPrev2_Off.gold, #lbNext2_Off.gold { color: #E1E100; }
       
#lbDetailsData { padding: 0 10px; }
        #lbDetailsData.grey { color: #333333; }
        #lbDetailsData.red { color: #620000; }
        #lbDetailsData.green { color: #003300; }
        #lbDetailsData.blue { color: #01379E; }
        #lbDetailsData.gold { color: #666600; }

#lbDetails { width: 60%; float: left; text-align: left; }
#lbCaption { display: block; font-weight: bold; }
#lbNumberDisplay { float: left; display: block; padding-bottom: 1.0em; }
#lbNavDisplay { float: left; display: block; padding-bottom: 1.0em; }

#lbClose { width: 64px; height: 28px; float: right; margin-bottom: 1px; }
        #lbClose.grey { background: url(images/close_grey.png) no-repeat; }
        #lbClose.red { background: url(images/close_red.png) no-repeat; }
        #lbClose.green { background: url(images/close_green.png) no-repeat; }
        #lbClose.blue { background: url(images/close_blue.png) no-repeat; }
        #lbClose.gold { background: url(images/close_gold.png) no-repeat; }

#lbPlay { width: 64px; height: 28px; float: right; margin-bottom: 1px; }
        #lbPlay.grey { background: url(images/play_grey.png) no-repeat; }
        #lbPlay.red { background: url(images/play_red.png) no-repeat; }
        #lbPlay.green { background: url(images/play_green.png) no-repeat; }
        #lbPlay.blue { background: url(images/play_blue.png) no-repeat; }
        #lbPlay.gold { background: url(images/play_gold.png) no-repeat; }
       
#lbPause { width: 64px; height: 28px; float: right; margin-bottom: 1px; }
        #lbPause.grey { background: url(images/pause_grey.png) no-repeat; }
        #lbPause.red { background: url(images/pause_red.png) no-repeat; }
        #lbPause.green { background: url(images/pause_green.png) no-repeat; }
        #lbPause.blue { background: url(images/pause_blue.png) no-repeat; }
        #lbPause.gold { background: url(images/pause_gold.png) no-repeat; }


但改完後出現一個比較不是那麼完美的地方
請見圖片--上方CLOSE那一排本應該在相片框的下方顯示--但現在莫名的跑到上方了^^|||(我嘗試很多方法~調整CSS都沒辦法使齊在原來的位置)


[ 本帖最後由 bau720123 於 2009-4-16 16:45 編輯 ]
邁向神乎其技的境界^^

TOP

當然可以壓
由於外部IP被公司封了~所以....
我再找找看有沒有可以讓我放檔案的網路空間
不好意思啦ㄚ_ㄚ

還是說我把我目前的成果直接打包一份給您
http://home.anet.net.tw/bau0123/all.rar
直接點兩下HTML檔就可以執行了
這樣好嗎

[ 本帖最後由 bau720123 於 2009-4-17 17:12 編輯 ]
邁向神乎其技的境界^^

TOP

謝謝您的回復
不過改完之後出現的位置還是維持置中耶
瀏覽器測試:IE6;FF3

原本
#lightbox{        position: absolute;        left: 0; width: 100%; z-index: 100; text-align: center; line-height: 0; }

後來
#lightbox{        position: absolute;        left: auto; width: auto; z-index: 100; text-align: center; line-height: 0; right:0; }

不知道您那邊的狀況是會變成靠右嗎??怪怪!@#$%^^|||

[ 本帖最後由 bau720123 於 2009-4-20 12:22 編輯 ]
邁向神乎其技的境界^^

TOP

謝謝您的回復
現在改過後狀況比較尷尬了

改過之後的狀況如下
IE6:維持置中
IE7:維持置中
IE8:不知道--事後報告(目前沒用過8版瀏覽器)
FF3:靠右對齊
Sa3:靠右對齊
Ch2:靠右對齊
Op9:靠右對齊

IE有時候還滿討厭的說^^|||

[ 本帖最後由 bau720123 於 2009-4-21 17:46 編輯 ]
邁向神乎其技的境界^^

TOP

謝謝您的回覆
根據您的提示我嘗試自己依樣畫葫蘆改了lightbox.js的某個地方
在原167行
$('outerImageContainer').setStyle({ width: size, height: size });

底下再插入
$('lightbox').setStyle({ width: size, height: size });

想不到出現了令人噴飯的結果
改的不對請見諒^^|||
分享給您了解看看

第一張圖--是在IE6底下的結果


第二張圖--是在FF3底下的結果


回家後我也灌灌看IE8瀏覽器~如果IE8可以跟FF3或是其它流覽器顯示一樣
那就不用再多費功夫在那邊校調了--畢竟IE8會是以後新作業系統的主流瀏覽器吧!!

[ 本帖最後由 bau720123 於 2009-4-22 11:56 編輯 ]
邁向神乎其技的境界^^

TOP

最新的回覆

在#9的程式碼改完後的最新狀況如下
IE6:維持置中
IE7:維持置中
IE8:靠右對齊
FF3:靠右對齊
Sa3:靠右對齊
Ch2:靠右對齊
Op9:靠右對齊

值得令人高興的一點就是
IE8終於有點進步
但是IE8的畫面顯示跟特效顯現~ㄎㄟˇㄎㄟˇ的耶

[ 本帖最後由 bau720123 於 2009-4-23 10:38 編輯 ]
邁向神乎其技的境界^^

TOP

好的~我再多努力找找嘗試看看好了
謝謝您的提醒
邁向神乎其技的境界^^

TOP

已解決並測試成功
再次感謝
邁向神乎其技的境界^^

TOP

返回列表 回復 發帖