IE 9不使用Raphael JS库渲染图像

时间:2011-11-29 00:29:53

标签: javascript internet-explorer-9 raphael

我正在制作Raphael JS动画,出于某种原因,我无法在Internet Explorer 9中渲染图像。这是我的代码:

<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=9" />
    <link type="text/css" rel="stylesheet" href="css/main.css" />
    <script type="text/javascript" src="scripts/raphael-min.js"></script>
    <script type="text/javascript" src="scripts/jquery-1.7.min.js"></script>
    <script type="text/javascript">
    $(document).ready(function() {
        var layer0 = Raphael("layer0", 980, 650);
        var bg = layer0.image("images/landscape_background.jpg", 0, 0, aniWidth, aniHeight);
    });
    </script>
</head>

<body>
    <div class="layer" id="layer0">
    </div>
    <div class="layer" id="layer1">
    </div>
    <div class="layer" id="layer2">
    </div>
    <div class="layer" id="layer3">
    </div>
    <div class="layer" id="layer4">
    </div>
</body>

</html>

它在chrome和firefox中运行良好,只是不是9。

1 个答案:

答案 0 :(得分:1)

您需要将拉斐尔启动器功能放在raphael代码周围才能使其正常工作。例如。 raphael(function(){