Fix displaying current section within styleguide
This commit is contained in:
@@ -2,7 +2,7 @@
|
|||||||
// ----------------------------------------------
|
// ----------------------------------------------
|
||||||
|
|
||||||
/* SG
|
/* SG
|
||||||
# Typography/
|
# Typography
|
||||||
|
|
||||||
```
|
```
|
||||||
<p class="Text Size-huge">Open Sans 26/34 Regular</p>
|
<p class="Text Size-huge">Open Sans 26/34 Regular</p>
|
||||||
@@ -47,4 +47,3 @@
|
|||||||
font-size: $sFontSize-small;
|
font-size: $sFontSize-small;
|
||||||
line-height: $sLineHeight-small;
|
line-height: $sLineHeight-small;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -20,7 +20,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* SG
|
/* SG
|
||||||
# Icon font
|
# IconFont
|
||||||
```
|
```
|
||||||
|
|
||||||
<h4>Clock</h4>
|
<h4>Clock</h4>
|
||||||
@@ -670,4 +670,3 @@
|
|||||||
.IconFont-Download::before {
|
.IconFont-Download::before {
|
||||||
content: '\E05C';
|
content: '\E05C';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -10,12 +10,20 @@
|
|||||||
var j = jQuery.noConflict(true);
|
var j = jQuery.noConflict(true);
|
||||||
j(function() {
|
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
|
// Show section in Styleguide
|
||||||
j('#styleguide .section[data-section="' + j('#styleguide-menu a').first().data('section') + '"]').show();
|
j('#styleguide .section[data-section="' + j('#styleguide-menu a').first().data('section') + '"]').show();
|
||||||
|
|
||||||
// Click on link with subheadings
|
// Click on link with subheadings
|
||||||
j('#styleguide-menu .submenulink').click(function(event) {
|
j('#styleguide-menu .submenulink').click(function(event) {
|
||||||
event.preventDefault();
|
// event.preventDefault();
|
||||||
var jqCurSubmenu = j('[data-submenu="' + j(this).data('section') + '"]');
|
var jqCurSubmenu = j('[data-submenu="' + j(this).data('section') + '"]');
|
||||||
var isCurSubmenuOn = jqCurSubmenu.hasClass('on');
|
var isCurSubmenuOn = jqCurSubmenu.hasClass('on');
|
||||||
j('#styleguide-menu .on').removeClass('on');
|
j('#styleguide-menu .on').removeClass('on');
|
||||||
@@ -28,7 +36,7 @@
|
|||||||
|
|
||||||
// Click on link without subheadings
|
// Click on link without subheadings
|
||||||
j('#styleguide-menu .sectionlink').click(function(event) {
|
j('#styleguide-menu .sectionlink').click(function(event) {
|
||||||
event.preventDefault();
|
// event.preventDefault();
|
||||||
j('#styleguide-menu .on').removeClass('on');
|
j('#styleguide-menu .on').removeClass('on');
|
||||||
j(this).addClass('on');
|
j(this).addClass('on');
|
||||||
showSection(j(this).data('section'));
|
showSection(j(this).data('section'));
|
||||||
@@ -48,7 +56,7 @@
|
|||||||
{{#each menu}}
|
{{#each menu}}
|
||||||
<li>
|
<li>
|
||||||
{{#if headings.0.name}}
|
{{#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}}">
|
<ul class="submenu" data-submenu="{{../name}}">
|
||||||
{{#each headings}}
|
{{#each headings}}
|
||||||
<li><a href="#{{id}}">{{name}}</a></li>
|
<li><a href="#{{id}}">{{name}}</a></li>
|
||||||
@@ -56,7 +64,7 @@
|
|||||||
</ul>
|
</ul>
|
||||||
{{/if}}
|
{{/if}}
|
||||||
{{#unless headings.0.name}}
|
{{#unless headings.0.name}}
|
||||||
<a class="sectionlink" href="#" data-section="{{name}}">{{name}}</a>
|
<a class="sectionlink" href="#{{name}}" data-section="{{name}}">{{name}}</a>
|
||||||
{{/unless}}
|
{{/unless}}
|
||||||
</li>
|
</li>
|
||||||
{{/each}}
|
{{/each}}
|
||||||
|
|||||||
Reference in New Issue
Block a user