bebaps / clear-menu Goto Github PK
View Code? Open in Web Editor NEWA simple mobile menu that is easy in integrate into an existing project.
A simple mobile menu that is easy in integrate into an existing project.
Allow the user to consume the minified dependency directly if they want.
Since babel is trans-piling anyhow variables should be declared with let
or const
instead of the none-function scoped var
.
https://github.com/bebaps/clear-menu/blob/master/src/clearmenu.js#L5
In order to allow the consumer to grab the CSS directly if they want, and/or to allow them to use the module if they don't use SASS
Having an auto height on the panel and reveling the panel from the bottom exposes empty space from the panel to the bottom of the viewport. Obviously not an issue if the panel is 100% height. Will need to make adjustments for this so that the panel can still be revealed from the bottom of the viewport regardless of how tall it is.
The same is true for setting an auto width and revealing from the right.
This was originally created to not use any classes on the menu itself, but after some thought it would be good to use JS to apply some classes. These do not actually need to have any styles applied to them, but can be there to help with targeting during state changes
Favor for the JavaScript standard over relying on the jQuery specific implementation. Less of an issue since this is a jQuery plugin, but something to consider.
When adding the class for reveal you can replace the switch statement since you already have a map declared.
switch (settings.reveal) {
case 'bottom':
$(settings.panel).addClass(classes.bottom);
break;
case 'left':
$(settings.panel).addClass(classes.left);
break;
case 'right':
$(settings.panel).addClass(classes.right);
break;
case 'fade':
$(settings.panel).addClass(classes.fade);
break;
default:
$(settings.panel).addClass(classes.top);
break;
}
can easily be re-written as
$(settings.panel).addClass(classes[settings.reveal] || classes.top)
Reduces the lines of code and get rid of the often problematic break;
requirement between cases.
https://github.com/bebaps/clear-menu/blob/master/src/clearmenu.js#L32
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.