我一直在试图弄清楚如何让这个网站上的启动页面在 IE8 及以下版本中正常工作?现在,它适用于所有其他浏览器(Firefox、Chrome、Safari)。这是网站:
http://gds.parkland.edu/student/fall10/gds220/ashipley/p2/final_revised/index.html
jQuery代码:
/* Sliding Affect Splash Page */
$(function() {
$('.box').each(function() {
var $this = $(this);
$.data(this, 'css', {
width: $this.css('width'),
background: $this.css('background-image')
});
});
});
function restore() {
$('.box').each(function() {
var orig = $.data(this, 'css');
$(this).animate({
width: orig.width
},{queue:false});
$(this).css({backgroundImage: orig.background});
});
}
/* box 1 */
function boxHover(){
$('.box').stop().animate({'width' : '596px'},{queue:false});
}
function box1master(){
$('.box2').css({backgroundImage: 'url(images/splash/zatgun_midtop.jpg)'});
$('.box3').css({backgroundImage: 'url(images/splash/zatgun_midbottom.jpg)'});
$('.box4').css({backgroundImage: 'url(images/splash/zatgun_bottom.jpg)'});
}
function box2master(){
$('.box1').css({backgroundImage: 'url(images/splash/bryan_top.jpg)'});
$('.box3').css({backgroundImage: 'url(images/splash/bryan_midbottom.jpg)'});
$('.box4').css({backgroundImage: 'url(images/splash/bryan_bottom.jpg)'});
}
function box3master(){
$('.box1').css({backgroundImage:'url(images/splash/galleries_top.jpg)'});
$('.box2').css({backgroundImage: 'url(images/splash/galleries_midtop.jpg)'});
$('.box4').css({backgroundImage: 'url(images/splash/galleries_bottom.jpg)'});
}
function box4master(){
$('.box1').css({backgroundImage: 'url(images/splash/contact_top.jpg)'});
$('.box2').css({backgroundImage: 'url(images/splash/contact_midtop.jpg)'});
$('.box3').css({backgroundImage: 'url(images/splash/contact_midbottom.jpg)'});
}
$(document).ready(function(){
$('.box1').hover(function(){
boxHover();
box1master();
}, function(){
restore();
});
$('.box2').hover(function(){
boxHover();
box2master();
}, function(){
restore();
});
$('.box3').hover(function(){
boxHover();
box3master();
}, function(){
restore();
});
$('.box4').hover(function(){
boxHover();
box4master();
}, function(){
restore();
});
});
我想知道是否可以使用 jQuery 更改每个框之间的间距,或者我是否必须以某种方式在 CSS/HTML 中执行此操作?
我在网站的 HTML 中弄乱的另一个项目是:
<!--[if lt IE 8]>
<style text="text/css">
.box2, .box3, .box4 { margin-top: 132px; }
</style>
<![endif]-->
每当我将边距更改为填充时,它的工作原理就不一样了。到目前为止,每当我将鼠标悬停在它上面时,它的间距都是正确的,但会将右侧的内容推到边缘,而不是显示另一侧的框。