Skip to content

Instantly share code, notes, and snippets.

@georgestephanis
Created May 3, 2012 22:10
Show Gist options
  • Select an option

  • Save georgestephanis/2589883 to your computer and use it in GitHub Desktop.

Select an option

Save georgestephanis/2589883 to your computer and use it in GitHub Desktop.
Add support for menus to WP7 and better support to Android
jQuery(document).ready(function($){
if( $('#wpadminbar li.menupop').size() ){
$('#wpadminbar li.menupop').click(function(e){
if( ! $(this).hasClass('hover') ){
$('#wpadminbar li.menupop.hover').removeClass('hover');
$(this).addClass('hover');
e.preventDefault();
return;
}
});
$(document).bind('click', function(e) {
if( !$(e.target).parents('#wpadminbar').size() ){
$('#wpadminbar li.menupop.hover').removeClass('hover');
}
});
}
if( $('#adminmenu > li.wp-has-submenu.wp-not-current-submenu').size() ){
$('#adminmenu > li.wp-has-submenu.wp-not-current-submenu').click(function(e){
if( ! $(this).hasClass('hover') ){
$(this).siblings('li.wp-has-submenu.wp-not-current-submenu').removeClass('hover').children('.wp-submenu').removeClass('sub-open');
$(this).addClass('hover').children('.wp-submenu').addClass('sub-open');
e.preventDefault();
return;
}
});
$(document).bind('click', function(e) {
if( !$(e.target).parents('#adminmenu').size() ){
$('#adminmenu > li.wp-has-submenu.wp-not-current-submenu').removeClass('hover').children('.wp-submenu').removeClass('sub-open');
}
});
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment