css 适用于 firefox 但不适用于 ie 或 chrome。如何修复 css,以便至少 IE 像 firefox 一样工作。
火狐:
IE:
图像也在背景中,但应该是透明的。
Chrome:
HTML:
<center><div id="slideshowContentArea" style="display:none; width:500px; height:300px">
<div class='nav'><a id='prev' href='#'>Prev</a>  <a id='next' href='#'>Next</a></div>
<div id="slideshow" class="pics" style="position: relative; overflow-x: hidden; overflow-y: hidden; height:250px; width:395px"> </div>
</div></center>
$('#slideshow').cycle(
{ fx: 'fade', timeout: 3000, speed: 500,
pager: '#slideshow', before: setBGBefore, prev:'#prev',next:'#next',after:onAfter
}
);
function setBGBefore() {
$(this).css({ 'background-image': 'url(' + $(this).find('img').attr('src') + ')',
'background-position': 'center top', 'background-color': 'transparent' });
$(".welcomeBox div").html($(this).find('span').html());
}
最佳答案
jQuery 可以告诉您正在使用的浏览器:
http://api.jquery.com/jQuery.browser/
更新。 问题标题是“check for chrome, ie & firefox”,这就是我回答的内容。如果他希望实现更优雅的解决方案,则取决于 OP。
关于jquery - html - css 检查 chrome、ie 和 firefox,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6204218/