Skip to content

Commit 3371294

Browse files
author
Marius Cramer
committed
- Responsive menu improved
1 parent b6b07d3 commit 3371294

File tree

5 files changed

+17
-6
lines changed

5 files changed

+17
-6
lines changed

interface/web/themes/default/assets/javascripts/responsive.js

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,21 +9,26 @@ function loadPushyMenu() {
99
// Hauptnavigation
1010
$('<ul />').appendTo($responsiveNavigation);
1111

12+
var $addto = false;
1213
$($mainNavigation).find('a').each(function () {
1314
var $item = $(this);
1415
var $activeClass = $item.hasClass('active') ? ' class="active"' : '';
16+
var isactive = $activeClass != '' ? true : false;
1517

1618
var capp = $item.attr('data-capp');
1719
if(capp) $activeClass += ' data-capp="' + capp + '"';
1820

1921
capp = $item.attr('data-load-content');
2022
if(capp) $activeClass += ' data-load-content="' + capp + '"';
2123

22-
$responsiveNavigation.find('ul').append($('<li><a href="' + $item.attr('href') + '"' + $activeClass + '><i class="icon ' + $item.data('icon-class') + '"></i>' + $item.text() + '</a></li>'));
24+
var $newel = $('<li><a href="' + $item.attr('href') + '"' + $activeClass + '><i class="icon ' + $item.data('icon-class') + '"></i>' + $item.text() + '</a></li>');
25+
if(isactive != '') $addto = $newel;
26+
$responsiveNavigation.find('ul').append($newel);
2327
});
2428

2529
// Subnavigation
26-
$('<ul class="subnavi" />').appendTo($responsiveNavigation);
30+
if(!$addto) $addto = $responsiveNavigation;
31+
$('<ul class="subnavi" />').appendTo($addto);
2732

2833
$($subNavigation).find('a').each(function () {
2934
var $item = $(this);
@@ -35,6 +40,9 @@ function loadPushyMenu() {
3540
capp = $item.attr('data-load-content');
3641
if(capp) addattr += ' data-load-content="' + capp + '"';
3742

43+
capp = $item.hasClass('subnav-header');
44+
if(capp) addattr += ' class="subnav-header"';
45+
3846
$responsiveNavigation.find('ul.subnavi').append($('<li><a href="' + $item.attr('href') + '"' + addattr + '>' + $item.text() + '</a></li>'));
3947
});
4048
};

interface/web/themes/default/assets/javascripts/responsive.min.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

interface/web/themes/default/assets/stylesheets/responsive.css

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,10 @@ html, body {
77
.pushy ul.subnavi li {
88
font-size: 12px; }
99
.pushy ul.subnavi li a {
10-
padding: 2px 10px; }
10+
padding: 2px 10px;
11+
font-weight: normal; }
12+
.pushy ul.subnavi li a.subnav-header {
13+
font-weight: bold; }
1114
.pushy a {
1215
padding: 10px;
1316
transition: color ease 500ms; }

interface/web/themes/default/assets/stylesheets/responsive.min.css

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

interface/web/themes/default/templates/sidenav.tpl.htm

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<tmpl_loop name="nav_left">
2-
<header><tmpl_if name="startpage"><a href="#" data-load-content="<tmpl_var name='startpage'>"></tmpl_if><tmpl_var name="title"><tmpl_if name="startpage"></a></tmpl_if></header>
2+
<header><tmpl_if name="startpage"><a href="#" class="subnav-header" data-load-content="<tmpl_var name='startpage'>"></tmpl_if><tmpl_var name="title"><tmpl_if name="startpage"></a></tmpl_if></header>
33
<ul id="sub-navigation">
44
<tmpl_loop name="items">
55
<li<tmpl_if name="html_id"> id='<tmpl_var name="html_id">' </tmpl_if>>

0 commit comments

Comments
 (0)