1
votes

Using Sencha Touch:

I want to create a slide out menu. But not like the facebook type:

enter image description here

What I want it to do instead is slide out on top(over the container under the title) and under the menu so it goes over it and not push it off to the right:

enter image description here

Ive searched and havent found any samples. Can anyone recommend a site or a tutorial on doing this.

Update - 5/24/2014 Thanks all for the different advice. The only thing is that I dont want it to look like the FB sliders. Ive seen those. I want it to slide over like the second screen shot i added. I was able to create it. Here is my code:

Ext.define('Slider.view.Main', 
{
    extend: 'Ext.Container',
    xtype: 'mainPage',
    requires: 
    [
        'Ext.TitleBar',
        'Ext.form.Panel',
        'Ext.List',
        'Ext.navigation.View',
        'Ext.Component',
        'Ext.Panel'
    ],

    config: 
    {
        layout: 'fit',
        items:
        [
            {
                xtype: 'titlebar',
                docked: 'top',
                title: 'Slider Test',
                items:
                [
                    {
                        iconCls: 'list',
                        align: 'left',
                        handler: function()
                        {

                            var con1 = Ext.ComponentQuery.query('container > #container1')[0];
                            var draggable = Ext.ComponentQuery.query('container > #navContainer')[0];

                            if(con1.element.hasCls('out'))
                            {

                                draggable.hide({type: 'slideOut', direction: 'left', duration : 500});


                                con1.element.removeCls('out').addCls('in');
                            }
                            else
                            {
                                con1.element.removeCls('in').addCls('out');
                                draggable.show({type:'slideIn', direction:'right', duration : 500});

                            }

                        }
                    }
                ]
            },

            {
                xtype: 'container',
                layout: 'hbox',
                itemId: 'container1',
                items:
                [

                    {
                        xtype: 'container',
                        layout: 'card',
                        width: 250,
                        hidden: true,
                        itemId: 'navContainer',
                        style: 'position: absolute; top: 0; left: 0; height: 100%;z-index: 2',
                        zIndex : 1,
                        items:
                        [
                            {
                                xtype: 'list',
                                itemTpl: '{title}',
                                data:
                                [
                                    { title: 'Item 1' },
                                    { title: 'Item 2' },
                                    { title: 'Item 3' },
                                    { title: 'Item 4' },
                                    { title: 'Item 2' },
                                    { title: 'Item 3' },
                                    { title: 'Item 4' },
                                    { title: 'Item 2' },
                                    { title: 'Item 3' },
                                    { title: 'Item 4' },
                                    { title: 'Item 2' },
                                    { title: 'Item 3' },
                                    { title: 'Item 4' }                     
                                ]
                            }
                        ]
                    },


                    {
                        xtype: 'container',
                        itemId: 'mainContainer',

                        width: '100%',
                        html: 'Main content area'
                    }



                ]
            }
        ]
    }
});
3

3 Answers

0
votes

Set cover to true.

Ext.Viewport.setMenu(this.createMenu(), {
    side: 'left',
    cover: true
});

This will have the menu slide out on top of the container. I'm not sure about having it under the nav bar, but some maybe some clever css can solve that problem.

0
votes

Thanks everyone for the tips. I was able to create what I wanted and posted the code under the update