[ticket/11957] Enhance responsive nav with JS

PHPBB3-11957
This commit is contained in:
Vjacheslav Trushkin 2013-10-25 19:59:45 +03:00
parent 8567adf5db
commit 43b9314390
2 changed files with 43 additions and 7 deletions

View file

@ -494,7 +494,7 @@ li {
@media only screen and (max-width: 700px), only screen and (max-device-width: 700px) @media only screen and (max-width: 700px), only screen and (max-device-width: 700px)
{ {
#menu { #menu, .rtl #menu {
float: none; float: none;
width: auto; width: auto;
border-width: 0; border-width: 0;
@ -502,27 +502,41 @@ li {
margin: 0 auto 10px; margin: 0 auto 10px;
} }
#menu .menu-block .header { #menu .menu-block.active {
margin-top: 0; margin: 0 -10px;
cursor: pointer; padding: 0 10px;
border-bottom-width: 0; background: rgba(255, 255, 255, .5);
border-radius: 5px;
} }
#menu .menu-block .header:focus { #menu .menu-block .header {
margin-top: 5px;
cursor: pointer;
border-bottom-width: 0;
position: relative;
text-decoration: underline;
}
#menu .menu-block .header:focus, #menu .menu-block.active .header {
color: #D31141; color: #D31141;
text-decoration: none;
} }
#menu .menu-block ul { #menu .menu-block ul {
display: none; display: none;
} }
#menu .menu-block:hover ul, #menu .menu-block.active ul, #menu .menu-block.no-header ul { .nojs #menu .menu-block:hover ul, #menu .menu-block.active ul, #menu .menu-block.no-header ul {
display: block; display: block;
} }
#menu .menu-block li:last-child { #menu .menu-block li:last-child {
border-bottom: 1px solid #327AA5; border-bottom: 1px solid #327AA5;
} }
#menu .menu-block:last-child li:last-child, #menu .menu-block.active li:last-child {
border-bottom-width: 0;
}
} }

View file

@ -2,6 +2,26 @@
* phpBB3 ACP functions * phpBB3 ACP functions
*/ */
/**
* Parse document block
*/
function parse_document(container)
{
var test = document.createElement('div'),
oldBrowser = (typeof test.style.borderRadius == 'undefined');
delete test;
/**
* Navigation
*/
container.find('#menu .menu-block > a.header').click(function() {
$(this).parent().toggleClass('active');
});
container.find('#activemenu').parents('.menu-block').addClass('active');
}
/** /**
* Run onload functions * Run onload functions
*/ */
@ -14,5 +34,7 @@
$('form[data-focus]:first').each(function() { $('form[data-focus]:first').each(function() {
$('#' + this.getAttribute('data-focus')).focus(); $('#' + this.getAttribute('data-focus')).focus();
}); });
parse_document($('body'));
}); });
})(jQuery); })(jQuery);