Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- var windowWidth = $(window).width(),
- $mainNav = $('nav.main-navigation');
- if (windowWidth <= 480) {
- var options = '',
- $select = $('<select class="menu"></select>');
- $mainNav
- .find('a').each(function(){
- var href = $(this).attr('href'),
- text = $(this).text();
- options += '<option value="'+ href +'">'+ text +'</option>';
- })
- $('<select class="menu"></select>')
- .append(options)
- .find('<option>')
- .click(function(){ location = $(this).val(); })
- .end()
- .appendTo($mainNav);
- }
Add Comment
Please, Sign In to add comment