1
我發現了一個很酷的菜單,我想將其包含在我的應用程序中(http://tympanus.net/codrops/2013/08/...vel-push-menu/)。如何在sencha touch(modernizr)中使用現有的js庫
所有文件都在正確的文件夾中。
起初我試圖將源代碼包含到index.html中,但它不起作用。 然後它試圖通過HTML小組做到這一點:
HTMLPanel.js
Ext.define('HTMLPanel', { extend: 'Ext.Panel',
// We are using Ext.Ajax, so we should require it
requires: ['Ext.Ajax'],
config: {
listeners: {
activate: 'onActivate'
},
// Create a new configuration called `url` so we can specify the URL
url: null
},
onActivate: function(me, container) {
Ext.Ajax.request({
// we should use the getter for our new `url` config
url: this.getUrl(),
method: "GET",
success: function(response, request) {
// We should use the setter for the HTML config for this
me.setHtml(response.responseText);
},
failure: function(response, request) {
me.setHtml("failed -- response: " + response.responseText);
}
});
}
}); app.js
var HTMLPanel = Ext.create('HTMLPanel', { // this is now `scrollable`, not `scroll`
//scroll: 'vertical',
scrollable: 'vertical',
url: 'menu.html'
});
// Add the new HTMLPanel into the viewport so it is visible
Ext.Viewport.add(HTMLPanel);
這種解決方案只能加載HTML代碼,但不啓動腳本加載菜單。
我包括在我的index.html需要的文件如下:
<link rel="stylesheet" type="text/css" href="css/normalize.css" /> <link rel="stylesheet" type="text/css" href="css/demo.css" />
<link rel="stylesheet" type="text/css" href="css/icons.css" />
<link rel="stylesheet" type="text/css" href="css/component.css" />
<script src="js/modernizr.custom.js"></script>
<script src="js/classie.js"></script>
<script src="js/mlpushmenu.js"></script>
在正確的方向任何暗示將不勝感激!
我已經嘗試瞭解決方案。它的工作原理,但很難用其他內容這樣做適當的佈局!
最好的問候,馬努