1

我正在尝试创建一个照片库。当我在 Firefox、Chrome 和 Safari 中查看它时,它可以完美运行并符合预期。但是(毫不奇怪),IE 无法正确显示图像。

我已经确定了这样的问题: 1.)大图像不显示,但是,您仍然可以右键单击图像应该存在的空间并将图像保存到您的计算机。2.)图库自动滚动到最后一张图片。

该站点尚未上线,因此这里是相关的 javascript、css 和 html:

 /*Time for the CSS*/

/*body, html { color: rgb(155, 152, 144); } this does not fix miscoloration of template*/
/* possible IE fixes:
 *
 * <meta http-equiv="X-UA-Compatible" content="IE=7"/>
 */



.slider{

    width: 640px; Same as width of the large image
    position: relative;
    /*Instead of height we will use padding*/
    padding-top: 320px; /*That helps bring the labels down*/

    margin: 100px auto;

    /*Lets add a shadow*/
    box-shadow: 0 10px 20px -5px rgba(0, 0, 0, 0.75);
}


/*Last thing remaining is to add transitions*/
.slider>img{
    position: absolute;
    left: 0; top: 0;
    transition: all 0.5s;
}





.slider input[name='slide_switch'] {
    /* display none for radio buttons is not compatable with IE,
     * using (potential) fix from http://www.jotform.com/answers/23448-IE-problem-with-radio-buttons
     */ 
    /*display: none;*/
    position: absolute; left: -9999px;
}

label { display: block; cursor: pointer; line-height: 20px; padding-bottom: 9px;  }








.slider label {
    /*Lets add some spacing for the thumbnails*/
    margin: 18px 0 0 18px;
    border: 3px solid #999;

    float: left;
    cursor: pointer;
    transition: all 0.5s;


    /*next two css properties are for IE-------------------------------*/
    zoom: 1;
    filter: alpha(opacity = 60);
    /*Default style = low opacity*/
    opacity: 0.6;
}

.slider label img{
    display: block;
}

/*Time to add the click effects*/
.slider input[name='slide_switch']:checked+label {
    border-color: #666;
    /*next two css properties are for IE----------------------------------*/
    zoom: 1;
    filter: alpha(opacity = 100);
    opacity: 1;
}
/*Clicking any thumbnail now should change its opacity(style)*/
/*Time to work on the main images*/
.slider input[name='slide_switch'] ~ img {
    /*next two css properties are for IE----------------------------------*/
    zoom: 1;
    filter: alpha(opacity = 0);
    opacity: 0;
    transform: scale(1.1);
}
/*That hides all main images at a 110% size
On click the images will be displayed at normal size to complete the effect
*/
.slider input[name='slide_switch']:checked+label+img {
    /*next two css properties are for IE----------------------------------*/
    zoom: 1;
    filter: alpha(opacity = 100);
    opacity: 1;
    transform: scale(1);
}
/*Clicking on any thumbnail now should activate the image related to it*/

这是(一些)HTML:

<!--MAIN PAGE HERE-->



    <h1>advancement photo galley!</h1>
    <h3>great stuff!!!</h3>



     <!--
We will make a slider with stylized thumbnails using CSS3
The markup is very simple:
Radio Inputs
Labels with thumbnails to detect click event
Main Image

thumbnail images are 100x50
full size images are 600x300???
-->
<div class="slider">
    <input type="radio" name="slide_switch" id="id1"/>
    <label for="id1"><img src="images/1.jpg" width="100" alt="1" /></label><!--this image is the thumbnail image-->
    <img src="images/1.jpg" alt="1"/><!--this one is the larger displayed image-->





    <input type="radio" name="slide_switch" id="id2" checked="checked"/>
    <label for="id2">
        <img src="images/2" width="100" alt="1"/>
    </label>
    <img src="images/2.jpg" alt="1"/>

    <input type="radio" name="slide_switch" id="id3"/>
    <label for="id3">
        <img src="images/3" width="100" alt="1"/>
    </label>
    <img src="images/3.jpg" alt="1"/>

    <input type="radio" name="slide_switch" id="id4"/>
    <label for="id4">
        <img src="images/4.jpg" width="100" alt="1"/>
    </label>
    <img src="images/4.jpg" alt="1"/>

    <input type="radio" name="slide_switch" id="id5"/>
    <label for="id5">
        <img src="images/5.jpg" width="100" alt="1"/>
    </label>
    <img src="images/5.jpg" alt="1"/>

    <input type="radio" name="slide_switch" id="id6"/>
    <label for="id6">
        <img src="images/6.jpg" width="100" alt="1"/>
    </label>
    <img src="images/6.jpg" alt="1"/>

    <input type="radio" name="slide_switch" id="id7"/>
    <label for="id7">
        <img src="images/7.jpg" width="100" alt="1"/>
    </label>
    <img src="images/7.jpg" alt="1"/>

    <input type="radio" name="slide_switch" id="id8"/>
    <label for="id8">
        <img src="images/8.jpg" width="100" alt="1"/>
    </label>
    <img src="images/8.jpg" alt="1"/>

    <input type="radio" name="slide_switch" id="id9"/>
    <label for="id9">
        <img src="images/9.jpg" width="100" alt="1"/>
    </label>
    <img src="images/9.jpg" alt="1"/>

    <input type="radio" name="slide_switch" id="id10"/>
    <label for="id10">
        <img src="images/10.jpg" width="100" alt="1"/>
    </label>
    <img src="images/10.jpg" alt="1"/>
</div>

<br><br><br>
<img src="arrow.jpg" id="current" onclick="this.answer.value=Scroll();" alt="arrow">
writeNum();


<!-- We will use PrefixFree - a script that takes care of CSS3 vendor prefixes
You can download it from http://leaverou.github.com/prefixfree/ -->
<script src="http://thecodeplayer.com/uploads/js/prefixfree.js" type="text/javascript"></script>
<p><br><br><br>
this is an image gallery for advancement services


these are words describing what is going on on this page

all of this is really important imformations</p>

提前感谢您的任何帮助/建议。出于安全原因,我不得不省略许多细节,我希望这是足够的信息。

4

1 回答 1

0

我要尝试的第一件事是为图像添加一个高度属性。尽管从规范中对宽度和高度属性进行了贬值,以支持在 css 中设置它们,但 oldIE 依赖于它们,因此最好同时拥有它们。基本上,如果缺少其中一个值,则假定您的意思是 0 高度。愚蠢,我知道,但这对你来说是 oldIE。大多数其他浏览器都会做正确的事情并查看图像数据以找出它的尺寸。

我还注意到您的宽度设置为width="100". 可能值得指定单位:width="100px".

于 2012-11-01T11:56:11.470 回答