有什麼方法可以爲ligtbox2設置固定/自定義高度嗎?Lightbox2中的自定義高度
#lightbox img{ width: auto; height: 600px;}
這僅調整大小的IMG而不是外容器。
有什麼方法可以爲ligtbox2設置固定/自定義高度嗎?Lightbox2中的自定義高度
#lightbox img{ width: auto; height: 600px;}
這僅調整大小的IMG而不是外容器。
這些解決方案都沒有工作,但感謝您的幫助球員。我必須讓我的手在js骯髒......這是我砍死代碼: lightbox.js
...
// once image is preloaded, resize image container
imgPreloader.onload = (function(){
var scale = 600/imgPreloader.height; //modified
this.lightboxImage.src = this.imageArray[this.activeImage][0];
this.resizeImageContainer((imgPreloader.width * scale), //modified imgPreloader.height);
}).bind(this);
imgPreloader.src = this.imageArray[this.activeImage][0];
},
//
// resizeImageContainer()
//
resizeImageContainer: function(imgWidth, imgHeight) {
// get current width and height
var widthCurrent = this.outerImageContainer.getWidth();
var heightCurrent = this.outerImageContainer.getHeight();
// get new width and height
var widthNew = (imgWidth + LightboxOptions.borderSize * 2);
var heightNew = (600 + LightboxOptions.borderSize * 2); //modified
...
該宣言要樣式的img
內#lightbox
嘗試刪除img
,使你只造型#lightbox
工作的呢?
#lightbox { width: auto; height: 600px;}
沒有骰子我的朋友 – Mikey1980 2010-05-21 12:19:09
如果經過HTML它創建你可以看到,它的包裹在div
與id="lightbox"
並在一個div
與id="outerImageContainer"
。後者具有圖像高度的樣式屬性。嘗試定位。覆蓋它在你的CSS或者在它被加載後改變高度。
<html>
<head>
<style type="text/css">
#lightbox { border : solid 2px #000000; position:absolute; }
#lightbox img { width:auto; height: 600px;}
</style>
</head>
<body>
<div id="lightbox">
<img src="Desert.jpg" alt="desert" />
</div>
</body>
</html>
現在只要我能拿到的樣機和mootools的相同的頁面我的工作d笑... ...大聲笑! – Mikey1980 2010-05-21 14:25:57
在IE8中不起作用 – Jeroen 2011-02-15 20:03:34