joggink / jquerymobiledropdown Goto Github PK
View Code? Open in Web Editor NEWPlugin to replace navigation with a dropdown for mobile devices
Plugin to replace navigation with a dropdown for mobile devices
Hey,
I recently implemented the CSStricks version of this code on http://wolfslittlestore.be/ (http://css-tricks.com/13303-convert-menu-to-dropdown/)
On my site there is some hierarchy within the work section, someone suggested using optgroup within the select to make this hierarchy visible in the dropdown.
The only problem I see is that an optgroup label is not clickable thus you would have to add an extra index/overview item too:
<optgroup label="Work">
<option>Overview</option>
<option>Webdesign</option>
<option>Interface design</option>
...
</optgroup>
I've been meaning to code this but my JS is nowhere near good enough.
Enable or disable the autohide via a parameter, otherwise some CSS + media queries can be used
// your navigation ul selector
$('#nav-main ul').mobileSelect({
autoHide : true
});
Something like:
// your navigation ul selector
$('#nav-main ul').mobileSelect({
deviceWidth: 400
});
I've added this plugin to a sandbox site - and it works really great.
Quick question though - when using the 'useWindowWidth' option it seems like I need to refresh my browser for the mobile drop down menu to replace the standard nav. Should that be the case? Is there a way to make the switch automatic?
Thanks in advance!
create a before / after hook so we can fix some things euhm... before and after I suppose
Something like this:
// your navigation ul selector
$('#nav-main ul').mobileSelect({
before : function(){ // do something; },
after: function(){ // do something else; }
});
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.