訊息視窗事件

訊息視窗事件

訊息視窗一般事件可將訊息視窗(InfoWindow)加入監聽事件,當改變訊息視窗的內容、關閉、位置或變更堆疊順序時,可觸發一系列的事件,進行後續的動作。 事件方法如下,詳細設定可參照範例。

function InitWnd() {

            var pBody = document.getElementById("TGMap");

            tg3dEarth = new TGOS.TEOnlineMap(pBody, null, function() {

            addInfoWindow();

            });

            msgDiv = document.getElementById("Msg");

            }

function addInfoWindow()

           {

            var InfoWindowOptions = {

            maxWidth: 1000,

            pixelOffset: { x: 0, y: 0 },

            zIndex: 0

            };

            messageBox = new TGOS.TEInfoWindow("內政部", new TGOS.TEPoint

             (121.519470, 25.042010), InfoWindowOptions);

            TGOS.TEEvent.addListener(messageBox, "domready", function () { msgDiv.innerHTML = "瀏覽器畫面資源加載前觸發事件" });

            messageBox.open(tg3dEarth);

            //加入監聽事件

            TGOS.TEEvent.addListener(messageBox, "content_changed", function () { msgDiv.innerHTML = "訊息視窗內容改變"; });

            TGOS.TEEvent.addListener(messageBox, "closeclick", function () { msgDiv.innerHTML = "點擊close按鍵"; });

            TGOS.TEEvent.addListener(messageBox, "position_changed", function () { msgDiv.innerHTML = "位置改變"; });

            }

 

回到上方