Skip to content

Instantly share code, notes, and snippets.

@addieljuarez
Created January 22, 2014 16:53
Show Gist options
  • Select an option

  • Save addieljuarez/8562397 to your computer and use it in GitHub Desktop.

Select an option

Save addieljuarez/8562397 to your computer and use it in GitHub Desktop.
menu Slide.
function ApplicationWindow() {
var open = false;
var self = Titanium.UI.createWindow({
backgroundColor:'red',
zIndex:1,
});
var winMain = Titanium.UI.createWindow({
width:320,
left:0,
backgroundColor:'#fff',
zIndex:0
});
var menuLeft = Titanium.UI.createButton({
top:25,
left:25,
title:'menu',
});
//--------------------------------------------------------------------------------------
// AddEventListener
//--------------------------------------------------------------------------------------
self.addEventListener('open', function(e){
winMain.open();
});
menuLeft.addEventListener('click', function(e){
if (open == false) {
var openAnimation = Titanium.UI.createAnimation({
duration:300,
left:200,
});
winMain.animate(openAnimation);
open = true;
}else if (open == true) {
var closeAnimation = Titanium.UI.createAnimation({
duration:300,
left:0,
});
winMain.animate(closeAnimation);
open = false;
};
});
winMain.add(menuLeft);
return self;
}
module.exports = ApplicationWindow;
@studiotopweb

Copy link
Copy Markdown

Hi, I wish to try your code, can you make us an example to how call your method? Thank you very much!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment