1

我有一个平面图脚本,可以在悬停时更改单个公寓图像,使它们显示不同的颜色。它适用于除 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'});
    });

});
4

0 回答 0