Fix displaying current section within styleguide

This commit is contained in:
xavijam
2016-01-18 16:31:15 +01:00
parent e863c2b8e7
commit b349796ad5
3 changed files with 16 additions and 10 deletions

View File

@@ -2,7 +2,7 @@
// ----------------------------------------------
/* SG
# Typography/
# Typography
```
<p class="Text Size-huge">Open Sans 26/34 Regular</p>
@@ -11,7 +11,7 @@
<p class="Text Size-medium">Open Sans 12/16 Semibold</p>
<p class="Text is-semibold Size-small">Open Sans 10/14 Semibold</p>
<p class="Text Size-small">Open Sans 10/14 Regular</p>
```
```
*/
@import '../variables/sizes';
@@ -47,4 +47,3 @@
font-size: $sFontSize-small;
line-height: $sLineHeight-small;
}

View File

@@ -19,8 +19,8 @@
line-height: 1;
}
/* SG
# Icon font
/* SG
# IconFont
```
<h4>Clock</h4>
@@ -670,4 +670,3 @@
.IconFont-Download::before {
content: '\E05C';
}

View File

@@ -10,12 +10,20 @@
var j = jQuery.noConflict(true);
j(function() {
// Show current section
var hash = window.location.hash.replace(/#/g, '');
if (hash) {
setTimeout(function() {
showSection(hash.split('-')[0]);
}, 0);
}
// Show section in Styleguide
j('#styleguide .section[data-section="' + j('#styleguide-menu a').first().data('section') + '"]').show();
// Click on link with subheadings
j('#styleguide-menu .submenulink').click(function(event) {
event.preventDefault();
// event.preventDefault();
var jqCurSubmenu = j('[data-submenu="' + j(this).data('section') + '"]');
var isCurSubmenuOn = jqCurSubmenu.hasClass('on');
j('#styleguide-menu .on').removeClass('on');
@@ -28,7 +36,7 @@
// Click on link without subheadings
j('#styleguide-menu .sectionlink').click(function(event) {
event.preventDefault();
// event.preventDefault();
j('#styleguide-menu .on').removeClass('on');
j(this).addClass('on');
showSection(j(this).data('section'));
@@ -48,7 +56,7 @@
{{#each menu}}
<li>
{{#if headings.0.name}}
<a class="submenulink" href="#" data-section="{{name}}">{{name}}</a>
<a class="submenulink" href="#{{name}}" data-section="{{name}}">{{name}}</a>
<ul class="submenu" data-submenu="{{../name}}">
{{#each headings}}
<li><a href="#{{id}}">{{name}}</a></li>
@@ -56,7 +64,7 @@
</ul>
{{/if}}
{{#unless headings.0.name}}
<a class="sectionlink" href="#" data-section="{{name}}">{{name}}</a>
<a class="sectionlink" href="#{{name}}" data-section="{{name}}">{{name}}</a>
{{/unless}}
</li>
{{/each}}