jquery - IE中的CSS问题。 Jquery 图像/swf 交换

标签 jquery css internet-explorer debugging flash

我有以下代码:

                <html>
                <head>
                <script type="text/javascript" language="javascript" src="jquery/jquery-1.5.1.js"></script> 
                <script type="text/javascript" language="javascript" src="http://jquery.thewikies.com/swfobject/jquery.swfobject.1-1-1.min.js"></script>
                <style>
                div#test{background:#ffffff;width:360px;height:360px;display:none;z-index:5;position: fixed;}
                #mainimage{z-index:-1;}
                </style>
                </head>
                <body>
                <table border="1">
                    <tr>
                        <td><div id="test"></div>
                            <div id="mainimage"><img id="full_image" src="1.jpg" alt="0" width="360" height="360" border="0" /></div>
                            <span id="flash" style="width:360px;height:360px;border:0px;margin:0px;padding:0px;z-index:-1;">
                            <object data="fireworks.swf" type="application/x-shockwave-flash" id="flash_99458582" width="360" height="360">
                                <param name="movie" value="fireworks.swf"><param name="wmode" value="opaque">
                            </object>
                            </span>
                        </td>
                        <td>
                            <table>
                                <tr>
                                    <td><a href="1.jpg" class="thumbnail"><img src="1.jpg" width="70" height="70"></a></td>
                                </tr>
                                <tr>
                                    <td><a href="2.jpg" class="thumbnail"><img src="2.jpg" width="70" height="70"></a></td>
                                </tr>
                                <tr>
                                    <td><img src="3.jpg" width="70" height="70" class="video"></td>
                                </tr>
                            </table>
                        </td>
                    </tr>
                </table>    
                <br /><br />
                <script type="text/javascript">
                $(document).ready(function() {
                    $("#flash").hide();
                    $('a.thumbnail').click(function(){  
                    var src = $(this).attr('href');

                    $("#test").fadeIn("slow", function () {
                        //$("#test").fadeOut("slow");
                        $("#flash").hide();
                        $("#test").hide();
                        $("img#full_image").show();
                        $("img#full_image").css({ opacity: 0 });
                        //alert(src);
                        if (src != $('img#full_image').attr('src').replace(/\?(.*)/,'')){
                            $('img#full_image').attr('src', src+'?'+Math.floor(Math.random()*(10*100)));                
                        }

                        $('img#full_image').stop().animate({opacity: '1'}, 'slow');
                    });



                    //alert("here");
                    return false;
                    });     
                    $('img.video').click(function(){
                        $("img#full_image").fadeOut("slow", function () {
                            $("#test").show();
                            $("#flash").show();
                            $("img#full_image").hide();
                            $("#test").fadeOut("slow");

                        }); 
                        return false;

                    });

                });
                </script>
                </body>
                </html>

这基本上有一些拇指,当您单击它时,它会作为主图像加载。单击时还有一个加载 swf 文件的缩略图。当加载主图像/swf 时,我也有淡入/淡出效果。这适用于 chrome 和 firefox,但是当我在 IE 中尝试时,由 jquery 加载的 div 将内容向下推送。谁能帮忙调试一下?

谢谢

最佳答案

您没有文档类型,因此您的页面正在使用 Quirks Mode .

在第一行添加 HTML5 文档类型:

<!DOCTYPE html>

我实际上并没有测试看这是否能解决您的问题,但可能性很大。

例如,您使用的 position: fixed 在 IE 的 Quirks 模式下不起作用。

关于jquery - IE中的CSS问题。 Jquery 图像/swf 交换,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6701361/

相关文章:

Javascript 执行函数 onload 但不触发按钮的 onclick 事件

javascript - jQuery Selectmenu 插件 - 无法隐藏选择框

javascript - Slick Carousel - 通过外部命令禁用控件和交互

javascript - 添加填充在 Chrome 和 Firefox 中的工作方式与在 Safari 中不同

css - 支付 Woocommerce Checkout 支付定位

javascript - 读取 CSV 错误 : Illegal Data. 发生了什么事?

css - 是否有任何网络应用程序可以将小图像合并为一个图像?

html - IE11 : Printing infinite pages

Javascript 执行阻止 IE 8 中的渲染/滚动

html - IE9 忽略同一样式表中的 *some* 媒体查询