我的网站 http://cynthiawoodyardlandscapedesign.com/ 有几个问题只出现在Firefox中。
单击主页上的图像时,左侧显示的允许用户更改图片的箭头位于页面顶部。持有箭头的div应该具有100%的高度,我甚至将!important
添加到CSS。只有Firefox没有正确显示。
我的css(http://cynthiawoodyardlandscapedesign.com/css/main.css):
#sheet {
width: 100%;
height: 100%;
position: fixed;
overflow: hidden;
top: 0;
left: 0;
background-color: rgba(0,0,0,0.8);
display: table;
z-index: 150;
}
#popover {
margin: auto;
background: rgba(0,0,0,0);
text-align: center;
padding: 10px;
border: 1px solid black;
position: relative;
display: table-cell;
vertical-align: middle;
}
#popover-image {
height: 70%;
border: 10px solid white;
}
#exit {
position: absolute;
top: 50px;
color: white;
font-size: 20px;
font-weight: bold;
width: 100%;
text-align: center;
z-index: 300;
font-family: sans-serif;
}
#next-image, #previous-image { cursor: pointer; background: transparent; }
#next-image::-moz-selection, #previous-image::-moz-selection,
#next-image::selection, #previous-image::selection { background: rgba(0,0,0,0); }
#leftArrow, #rightArrow {
width: 20%;
height: 100% !important;
position: absolute;
z-index: 200;
display: table;
background: transparent;
top: 0;
}
#leftArrow { left: 0; } #rightArrow { right: 0; }
#next-image {
display: table-cell !important;
vertical-align: middle;
margin: 0 auto;
text-align: center;
line-height: 50px;
font-size: 50px;
-webkit-text-stroke: 1px black;
-moz-text-stroke: 1px black;
height: 50px;
width: 50px;
color: white;
}
#previous-image {
display: table-cell !important;
vertical-align: middle;
margin: 0 auto;
text-align: center;
line-height: 50px;
font-size: 50px;
-webkit-text-stroke: 1px black;
-moz-text-stroke: 1px black;
height: 50px;
width: 50px;
color: white;
}
我的HTML(http://cynthiawoodyardlandscapedesign.com/default.php):
<div id="sheet">
<div id="exit">Exit</div>
<div id="popover">
<div id="leftArrow"><div id="previous-image" onclick="previous()">«</div></div>
<img src="watermark.php?src=images/main1.jpg&x=0&y=420&opactity=50" id="popover-image" onclick="close()" />
<div id="rightArrow"><div id="next-image" onclick="next()">»</div></div>
</div>
</div>
我尝试过的所有其他浏览器(IE除外;我在Mac上)都能正确显示页面。
编辑:我有更多的Firefox问题。
http://cynthiawoodyardlandscapedesign.com/photography.php处的页面显示了<td>
个标签中的许多图片,img
之后但</td>
之前有一个具有绝对位置的范围{ {1}}在每个浏览器上(甚至是IE8 !!)它都无法正常工作。
我的HTML页面:
top: 10px;
<table id="photos">
<tr>
<td><img src="images/photo-thumbs/garden.jpg" /><span>Gardens</span></td><td><img src="images/photo-thumbs/trees.jpg" /><span>Trees</span></td><td><img src="images/photo-thumbs/shrubs.jpg" /><span>Shrubs</span></td><td><img src="images/photo-thumbs/perennials.jpg" /><span>Perennials</span></td>
</tr>
<tr>
<td><img src="images/photo-thumbs/annuals.jpg" /><span>Annuals</span></td><td><img src="images/photo-thumbs/tropicals.jpg" /><span>Tropicals</span></td><td><img src="images/photo-thumbs/bulb.jpg" /><span>Bulbs</span></td><td><img src="images/photo-thumbs/containers.jpg" /><span>Containers</span></td>
</tr>
<tr>
<td><img src="images/photo-thumbs/fruit.jpg" /><span>Fruit</span></td><td><img src="images/photo-thumbs/animals.jpg" /><span>Creatures</span></td><td><img src="images/photo-thumbs/people.jpg" /><span>People</span></td><td><img src="images/photo-thumbs/travel.jpg" /><span>Travel</span></td>
</tr>
</table>
答案 0 :(得分:3)
以下是第二部分的答案:跨度位置的悬停问题。它工作正常,请参阅我在html,css和jquery代码中所做的以下更改。如果我遗失了什么,请告诉我。
代码: http://jsfiddle.net/brNdq/1/
工作演示: http://jsfiddle.net/brNdq/1/embedded/result/
<强> HTML:强>
<table id="photos">
<tr>
<td><div class="img_container"><img src="http://cynthiawoodyardlandscapedesign.com/images/photo-thumbs/garden.jpg" /><span>Gardens</span></div></td>
<td><div class="img_container"><img src="http://cynthiawoodyardlandscapedesign.com/images/photo-thumbs/trees.jpg" /><span>Trees</span></div></td>
<td><div class="img_container"><img src="http://cynthiawoodyardlandscapedesign.com/images/photo-thumbs/shrubs.jpg" /><span>Shrubs</span></div></td>
<td><div class="img_container"><img src="http://cynthiawoodyardlandscapedesign.com/images/photo-thumbs/perennials.jpg" /><span>Perennials</span></div></td>
</tr>
<tr>
<td><div class="img_container"><img src="http://cynthiawoodyardlandscapedesign.com/images/photo-thumbs/annuals.jpg" /><span>Annuals</span></div></td>
<td><div class="img_container"><img src="http://cynthiawoodyardlandscapedesign.com/images/photo-thumbs/tropicals.jpg" /><span>Tropicals</span></div></td>
<td><div class="img_container"><img src="http://cynthiawoodyardlandscapedesign.com/images/photo-thumbs/bulb.jpg" /><span>Bulbs</span></div></td>
<td><div class="img_container"><img src="http://cynthiawoodyardlandscapedesign.com/images/photo-thumbs/containers.jpg" /><span>Containers</span></div></td>
</tr>
</table>
<强> CSS:强>
.img_container {
position:relative;
}
Jquery:从TD中删除悬停并将其放在课堂上.img_container
<script type="text/javascript">
$(document).ready(function () {
$(".img_container").hover(function() {
$(this).children('span').fadeIn('medium');
}, function () {
$(this).children('span').fadeOut('fast');
});
});
</script>
答案 1 :(得分:1)
高度的使用百分比将下降到地狱。从历史原因来看,100%的高度被视为窗口的高度,而不是显示区域。避免使用百分比 - 仅限于此处的异常宽度:20%。
如果您想设置高度:100%,请使用JavaScript。获取显示区域的高度并为这两个div设置它。我正在发布一个示例,我将其用于叠加窗口(在调整大小时也可以使用):
var updateInterval;
function showOverlay() {
updateInterval = setInterval(function() {
var h = 0;
var s = 0;
if (window.innerHeight) {
h = window.innerHeight;
}
else if (document.documentElement.clientHeight) {
h = document.documentElement.clientHeight;
}
if (document.body.scrollTop) {
s = document.body.scrollTop;
}
else if (window.pageYOffset) {
s = window.pageYOffset;
}
document.getElementById('overlay').style.height = '' + h + 'px';
document.getElementById('overlay').style.top = '' + s + 'px';
}, 10);
toogleHidden('overlay');
}
替换您的ID的叠加ID,toogleHidden是我显示/隐藏元素的功能。
您可以使用类似功能正确放置元素 - 您知道,例如你的elemtn是32px高,所以你得到高度,除以2并减去16:
var top = (h / 2) - 16;
比你不需要设置100%的高度(除了整列应该是可点击的)。
希望这有帮助。
答案 2 :(得分:0)
将style="display:block"
与FF中的"position:absolute"
结合使用