Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Titanium - Simple Slide Down Info Window
var win = Ti.UI.createWindow({
backgroundColor:'#dfdfdf',
title:'Main Win',
navBarHidden:false
});
var lbl = Ti.UI.createLabel({
text:'Background Window'
});
win.add(lbl);
var InfoWin = require('InfoWin'),
infowin = new InfoWin();
win.addEventListener('open', function() {
infowin.open();
});
win.open();
function InfoWin(_args) {
var self = Ti.UI.createWindow({
backgroundColor:'#000',
height:480,
bottom:436
});
var infolbl = Ti.UI.createLabel({
text:'Info',
color:'#fff',
bottom:0
});
var isShowing = false;
infolbl.addEventListener('click', function() {
if (isShowing) {
self.animate({
bottom:436
});
isShowing = false;
} else {
self.animate({
bottom:80
});
isShowing = true;
}
});
var infotxt = Ti.UI.createLabel({
text:'This is more information about the background window. Click "Info" again to hide.',
color:'#fff'
});
self.add(infotxt);
self.add(infolbl);
return self;
};
module.exports = InfoWin;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment