2012-12-13 181 views
0

因此,我問了一個關於與骨幹和jQuery的Windows Phone 7的問題,並要求。requirejs在Windows Phone 7

我進行了調查這個和剝離下來到剛剛有

<script data-main="js/main" src="js/vendor/require/requireNew.js"></script> 

然後,僅僅有一個路徑jQuery的

一個main.js最低限度

和索引頁

require.config({ 
//path mappings for module names not found directly under baseUrl 
paths: { 
    jquery:  'vendor/jqm/jquery_1.7_min' 
} 

}); 

alert('why'); 

$(document).ready(function() { 
    alert('DOM IS READY '); 
});  

在Windows 7中它會顯示警告爲什麼 - 但不是DOM在這裏...

它會在每個其他瀏覽器上執行此操作,包括ie7!

任何人都可以幫忙嗎?

回答

0

不知道你是否使用Phonegap,如果不是你應該(或等價的框架)。

如果您按照下列指示enter link description here

您將能夠建立一個默認的PhoneGap應用WP7當你有一個看看生成的index.js

var app = { 
    // Application Constructor 
    initialize: function() { 
     this.bindEvents(); 
    }, 
    // Bind Event Listeners 
    // 
    // Bind any events that are required on startup. Common events are: 
    // `load`, `deviceready`, `offline`, and `online`. 
    bindEvents: function() { 
     document.addEventListener('deviceready', this.onDeviceReady, false); 
    }, 
    // deviceready Event Handler 
    // 
    // The scope of `this` is the event. In order to call the `receivedEvent` 
    // function, we must explicity call `app.receivedEvent(...);` 
    onDeviceReady: function() { 
     app.receivedEvent('deviceready'); 
    }, 
    // Update DOM on a Received Event 
    receivedEvent: function(id) { 
     var parentElement = document.getElementById(id); 
     var listeningElement = parentElement.querySelector('.listening'); 
     var receivedElement = parentElement.querySelector('.received'); 

     listeningElement.setAttribute('style', 'display:none;'); 
     receivedElement.setAttribute('style', 'display:block;'); 

     console.log('Received Event: ' + id); 
    } 
}; 

這是多一點因爲您首先必須等待「設備準備就緒」事件,才能獲得「準備就緒」事件