Skip to content

Commit 7ad9bdb

Browse files
committed
Fix IDs on tutorials page and add highlight effect
1 parent 713d0a6 commit 7ad9bdb

3 files changed

Lines changed: 42 additions & 7 deletions

File tree

docs/tutorials/index.html

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,17 @@
44
include_masonry: "true"
55
---
66

7-
These tutorials will walk you through working with a wide range of hardware and
8-
software. If you're looking for help with a specific goal, this is the place to
9-
look!
7+
<p class="lead">
8+
These tutorials will walk you through working with a wide range of hardware and
9+
software. If you're looking for help with a specific goal, this is the place to
10+
look!
11+
</p>
1012

11-
<div class="row masonry-container" data-masonry='{ "itemSelector": ".tutorial-panel", "columnWidth": ".grid-sizer", "percentPosition": true }'>
13+
<div class="row masonry-container" data-masonry='{ "itemSelector": ".tutorial-group-item", "columnWidth": ".grid-sizer", "percentPosition": true }'>
1214
<div class="grid-sizer col-xs-12 col-sm-6 col-md-6"></div>
1315
{% for group in site.data.tutorial-groups %}
14-
<div class="col-xs-12 col-sm-6 col-md-6 tutorial-panel">
15-
<div class="panel panel-default rounded-panel" id="group-{{ group.name | downcase | replace: ' ','-' }}">
16+
<div class="col-xs-12 col-sm-6 col-md-6 tutorial-group-item">
17+
<div class="panel panel-default rounded-panel tutorial-panel" id="group-{{ group.id }}">
1618
<div class="panel-heading">{{ group.title }}</div>
1719
<div class="panel-body">
1820
<p>

javascripts/style-helpers.js

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,4 +7,15 @@ $(document).ready(function () {
77
$('.masonry-container').imagesLoaded().progress(function() {
88
$('.masonry-container').masonry('layout');
99
})
10-
})
10+
})
11+
12+
// Offsets view so that nav doesn't cover URL target. There are CSS3 solutions
13+
// to this, but they are hacky and full of caveats.
14+
$(window).on('hashchange load', function () {
15+
var $anchor = $(':target'),
16+
fixedElementHeight = 100;
17+
18+
if ($anchor.length > 0) {
19+
window.scrollTo(0, $anchor.offset().top - fixedElementHeight);
20+
}
21+
});

stylesheets/page-content.scss

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
---
22
---
33

4+
@import "custom-variables";
5+
46
.language-icon {
57
height: 25px;
68
}
@@ -42,4 +44,24 @@
4244

4345
.release-link-container {
4446
display: none;
47+
}
48+
49+
:target.tutorial-panel {
50+
animation: target-tutorial-panel-fade 5s 1;
51+
52+
.panel-heading {
53+
animation: target-tutorial-panel-header-fade 5s 1;
54+
}
55+
}
56+
57+
@keyframes target-tutorial-panel-fade {
58+
0% { border-color: $brand-primary; }
59+
80% { border-color: $brand-primary; }
60+
100% { border-color: $panel-default-border; }
61+
}
62+
63+
@keyframes target-tutorial-panel-header-fade {
64+
0% { border-left-color: $brand-primary; }
65+
80% { border-left-color: $brand-primary; }
66+
100% { border-left-color: $panel-default-border; }
4567
}

0 commit comments

Comments
 (0)