我有一个平面图的脚本,可以在悬停时更改单个公寓图像,以便显示不同的颜色。它适用于除IE7之外的每个浏览器。在IE7上盘旋时,图像会改变,但不会改变到正确的图像,而是改变到另一层的图像。我自己没有编写脚本,我只是负责调试它,并且不知道它在IE7中哪些部分无法正常工作。任何帮助将不胜感激!
这是脚本:
$(document).ready(function() {
// add links to sidebar
$('#secondary-nav').append('<li id="f2" class="floor">Floor 2</li>');
$('#secondary-nav').append('<li id="f3" class="floor">Floor 3</li>');
$('#secondary-nav').append('<li id="f4" class="floor">Floor 4</li>');
$('#secondary-nav').append('<li id="f5" class="floor">Floor 5</li>');
$('#secondary-nav').append('<li id="f6" class="floor">Floor 6</li>');
$('#secondary-nav').append('<li id="f7" class="floor">Floor 7</li>');
// display floor
$('#secondary-nav li').click(function(){
var floor = $(this).attr('id').replace('f','');
$('#frame').fadeOut(200);
$('#secondary-nav li').removeClass('current');
setTimeout(function() {
$('#floors li#f'+floor).addClass('current');
$('.units').css('display','none');
$('#frame').css('background-image','url(floorplans/img/selectors/floorplates-bg/'+floor+'.png)');
$('#frame').fadeIn(200);
$('#floor'+floor).fadeIn(200);
}, 500);
});
// highlight on mouseover
$(".units div").hover(function(){$('img',this).stop().animate({opacity:0},200);},
function(){$('img',this).stop().animate({opacity:1},200);});
// display floorplan
$('.units div').each(function(i){
var floor = $(this).parent().attr('id').replace('floor','');
var unit = floor + $(this).attr('class').replace('u','');
var details = $('a',this).attr('title');
var group = $('a',this).attr('class').replace('i','');
$(this).click(function(){
$('#details .info h1').html('Unit '+unit);
$('#details .info h2').html(details);
$('#details .info a').attr('href','floorplans/downloads/'+group+'.pdf');
$('#details .floorplate img').attr('src','floorplans/img/floorplans/floorplates/Unit-'+unit+'.png');
$('#details .floorplan img').attr('src','floorplans/img/floorplans/'+group+'.png');
});
$(this).fancybox({'href':'#details'});
});
});