編輯:哇,我是多麼白癡。爲了使它很容易理解,我想解釋一下facebook本地應用的功能。您觸摸右上角和左上角的位置,中間部分向左或向右移動,顯示側欄菜單滑入目標視圖C
我有一個phonegap應用程序,其中右上角有一個按鈕。以下面的代碼作爲參考。
Portion of HTML:
<body>
<div id="header"><!--Button goes here--></div>
<div id="menu">
<ul>
<li> Option 1</li>
<li> Option 2</li>
</ul>
</div>
<div id="page">
Some contents in the page.
</div>
</body>
Javascript:
var move,x=0; //global vars
function buttonTouched() { //code for button ontouchstart event
move = $("#menu").css('width');
if(x==0) {
$("#menu").animate({'left':'-='+move},'250');
$("#page").animate({'left':'-='+move},'250');
x=1;
}
else if(x==1) {
$("#menu").animate({'left':'+='+move},'250');
$("#page").animate({'left':'+='+move},'250');
x=0;
}
}
當你觸摸按鍵,左「菜單」幻燈片DIV(使用jQuery動畫)和「頁」的一部分DIV轉到左邊。如何使用具有動畫效果的客觀C代碼在原生應用中複製這種效果?
感謝
請求MODS的關閉問題,因爲我已經試着問同樣的問題在這裏看到 http://stackoverflow.com/questions/7989020/whats-最好的方式來開發一個側面菜單像一個在facebooks新我 – thandasoru 2013-02-21 08:42:39