0 padding not working?
XBLDev opened this issue · 3 comments
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!
I'm looking to do the same! This way you can have an overlay menu rather than it sliding the content.
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;
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 :)