Mango / slideout

A touch slideout navigation menu for your mobile web apps.
https://slideout.js.org
MIT License
7.94k stars 1.15k forks source link

0 padding not working? #266

Open XBLDev opened 6 years ago

XBLDev commented 6 years ago

Hi

It seems when I give padding a 0, it defaults to 256? Is it my misunderstanding or is it just designed that way? i simply just want the menu to show without any sliding, for now I'm setting the padding to -1 which kinda makes it look like it opened without any sliding, but I can still see that 1px white edge.

Thanks in advance for any help!

robertvrabel commented 6 years ago

I'm looking to do the same! This way you can have an overlay menu rather than it sliding the content.

anmatika commented 6 years ago

I would also like to set padding as 0 but it seems not possible with the current implementation because it padding is set in like this. this._padding = this._translateTo = parseInt(options.padding, 10) || 256;

And with 0 it becomes parseInt(0, 10) || 256; Which is 0 || 256

Which is 256

It could be fixed something like this but I'm not sure if the current implementation is intended behaviour of the library.

 var padding = parseInt(options.padding, 10);
 this._padding = this._translateTo = isNaN(padding) ? 256 : padding;
robertvrabel commented 6 years ago

It has been awhile since I did this, but I was able to get my desired outcome of having it overlay on the content.

    // Initialize slideout
    var slideout = new Slideout({
        'panel': document.getElementById('panel'),
        'menu': document.getElementById('menu'),
        'padding': -1,
        'tolerance': 70,
        'side': 'right',
    });

If you make the viewport small on https://base.wayne.edu you can click the hamburger icon in the upper right to see the outcome. If that is something you want to replicate I can share further code if necessary :)