0

我在 jquery-ui 对话框中弹出 google earth 插件。这适用于 jquery-ui 1.9.2,但在升级到 1.10.2 后,插件会加载,但在尝试移动对话框时,谷歌地球停止使用“谷歌地球插件出现内部错误。请尝试重新加载页面。”

Win7 和 OSX 10.8.2 都会出现这种情况,Chrome 和 Safari 也会出现这种情况。还有其他人遇到这个问题吗?解决方法?

这是下面代码的jsfiddle,如果您将 jquery-ui 降级到 1.9.2 一切正常:

<!DOCTYPE HTML>
<html>
    <script type="text/javascript" src="//www.google.com/jsapi"></script>

    <script src="//ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script>

    <script src="//ajax.googleapis.com/ajax/libs/jqueryui/1.10.2/jquery-ui.min.js"></script>
    <link type="text/css" href="//ajax.googleapis.com/ajax/libs/jqueryui/1.10.2/themes/smoothness/jquery-ui.css" rel="stylesheet" />
<script>

var loaded = false;

function loadGE() {
    google.load('earth', '1', {
        callback: function () {
            google.earth.createInstance('editmap3d', function (instance) {
                initEditGE(instance);
            }, function () {
                failureGE();
            });
        }
    });
}

function initEditGE(instance) {
    loaded = true;
    ge = instance;

    var lookAt = ge.createLookAt('');
    lookAt.setLatitude(36.584207);
    lookAt.setLongitude(-121.754322);
    lookAt.setRange(5000.0); //default is 0.0

    ge.getView().setAbstractView(lookAt);
    ge.getWindow().setVisibility(true);
    ge.getNavigationControl().setVisibility(ge.VISIBILITY_SHOW);
}

function failureGE() {
    console.log("GE failed to load...");
}


$(document).ready(function () {
    $("#opendialog").button().click(function () {
        $("#editDialog").dialog("open");

        if (!loaded) loadGE();
    });

    $("#editDialog").dialog({
        autoOpen: false,
        height: 500,
        width: 500,
        modal: true,
        resizable: false
    });
})


</script>

<body>
    <div>GE in popup</div>
    <button id="opendialog">open</button>
    <div id="editDialog">
        <div id="mapcontainer" style="width:600; height:600;">
            <div id="editmap3d" style="height:100%;"></div>
        </div>

    </div>
</body>
</html>
4

1 回答 1

0

我实际上观察到与 1.10.1 类似的情况,插件加载然后崩溃。我确实注意到它在非缩小版本中运行良好,但在 1.10.1 的缩小版本中崩溃。

编辑:我的问题不是 jquery-ui,而是 jquery 和谷歌地球。使用 UI 1.10.3,无论是 min 还是 min 似乎都可以正常工作。

于 2013-06-25T17:53:34.910 回答