【问题标题】:Css problem in IE. Jquery image / swf swapIE中的CSS问题。 jQuery 图像/swf 交换
【发布时间】:2011-07-15 00:01:44
【问题描述】:

我有以下代码:

                <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 会将内容向下推。谁能帮忙调试一下?

谢谢

【问题讨论】:

  • 您的叠加层(div 或图像)需要绝对/固定定位。您在点击时显示的图像标签不是。您的测试 div 是否按预期工作?

标签: jquery css internet-explorer debugging flash


【解决方案1】:

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

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

<!DOCTYPE html>

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

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

【讨论】:

  • 天啊!!!我从来不知道这一点。哈哈。谢谢绝对每天都能学到新东西!!!!这解决了问题。
猜你喜欢
  • 1970-01-01
  • 2011-09-23
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2011-11-09
  • 2021-11-28
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多