Skip to content

Design refresh #629

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 23 commits into from
May 19, 2015
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
ef7f55d
Implemented basics of new design
wvteijlingen Mar 27, 2015
c288a31
Changed h3s to h2s on FAQ page
wvteijlingen Mar 27, 2015
fd5e53f
Sidebar affix, CSS vendor prefixes
wvteijlingen Mar 29, 2015
74b91cb
Removed fixed width from quicklinks
wvteijlingen Mar 30, 2015
edc1de7
Rename quicklinks and examples
wvteijlingen Mar 30, 2015
836c132
Improved responsiveness
wvteijlingen Mar 30, 2015
5c9087e
Removed old styling for code blocks
wvteijlingen Mar 30, 2015
10d37b1
Added social links to footer
wvteijlingen Mar 30, 2015
cdd70a8
Changed typography to Helvetica Neue
wvteijlingen Mar 30, 2015
5c22119
Improved responsiveness of header
wvteijlingen Mar 30, 2015
d1be980
Fixed respsonsive bug with logo
wvteijlingen Mar 30, 2015
fd1a549
Updated quicklinks margin
wvteijlingen Mar 30, 2015
0d69f80
Removed separate header and footer includes.
wvteijlingen Mar 30, 2015
21f9808
Moved Javascript to all.js
wvteijlingen Mar 30, 2015
78588b0
Removed code collapsing from Javascript.
wvteijlingen Mar 30, 2015
00273f2
Added a check to prevent creation of document outline when no sidebar…
wvteijlingen Mar 30, 2015
617abd7
Removed trailing dot from index page title.
wvteijlingen Mar 30, 2015
dfcb62d
Remove redundant table of contents
dgeb May 19, 2015
b830cbc
Show page title unless showing masthead.
dgeb May 19, 2015
9578f41
Show sidebar for Extensions, Implementations, and Recommendations.
dgeb May 19, 2015
b0ad081
Remove redundant title declaration.
dgeb May 19, 2015
c01a940
Sidebar and H1 styling tweaks.
dgeb May 19, 2015
18db614
Rework masthead and logo.
dgeb May 19, 2015
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Sidebar affix, CSS vendor prefixes
Added sidebar scroll affix, CSS vendor prefixes, improves HTML structure
  • Loading branch information
wvteijlingen authored and dgeb committed May 19, 2015
commit fd5e53fa2af7965ed6a9acf1cea6cc639070b2d5
4 changes: 2 additions & 2 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ gem "rake", "~> 10.0"
gem "jekyll", "~> 1.0"
gem "redcarpet", "~> 2.2"
gem "rb-fsevent", "~> 0.9"
gem "compass", "~> 0.12"
gem "sass", "~> 3.2"
gem "compass", "~> 1.0"
gem "sass", "~> 3.4"
gem "launchy", "~> 2.3"
gem "redcard", "~> 1.0"
20 changes: 12 additions & 8 deletions _layouts/page.html
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<meta content="IE=edge,chrome=1" http-equiv="X-UA-Compatible">

<!-- Use title if it's in the page YAML frontmatter -->
<title>JSON API :: {{ page..title }}</title>
<title>JSON:API - {{ page.title }}</title>

<link href='http://fonts.googleapis.com/css?family=Titillium+Web:400,300,600' rel='stylesheet' type='text/css'>
<link href="/stylesheets/normalize.css" media="screen" rel="stylesheet" type="text/css" />
Expand Down Expand Up @@ -35,21 +35,25 @@
<h1>JSON:API</h1>
<div class="quicklinks">
{% for link in site.quicklinks %}
<a href="{{link.url}}">{{link.title}}</a>
<a href="{{link.url}}" title="{{link.title}}">{{link.title}}</a>
{% endfor %}
</div>
</div>
</header>
{% endif %}
<div class="site-wrapper">
{% if page.show_sidebar %}
<nav class="site-content-nav" id="document-outline">
<h2>{{ page.title }}</h2>
</nav>
<div class="sidebar">
<nav class="site-content-nav" id="document-outline">
<h2>{{ page.title }}</h2>
</nav>
</div>
{% endif %}
<section class="site-content">
{{ content }}
</section>
<div class="content">
<section>
{{ content }}
</section>
</div>
</div>
<footer>
<span>Built with <a href="http://jekyllrb.com/">Jekyll</a> and <a href="http://softwaremaniacs.org/soft/highlight/en/">Highlight.js</a></span>
Expand Down
71 changes: 47 additions & 24 deletions javascripts/sidebar-nav.js
Original file line number Diff line number Diff line change
@@ -1,14 +1,29 @@
$(document).ready(function() {
var articleOutline = createOutlineFromArticle($('.site-content').eq(0));
// Build navigation list
var articleOutline = createOutlineFromElement($('.content').eq(0));
var navList = createArticleNavigationFromOutline(articleOutline);
$("#document-outline").append(navList);

$("#document-outline li").click(function(event) {
$("#document-outline li").removeClass('active');
$(this).toggleClass('active');
})
// Scroll affix
fixElement($(".sidebar"), 50);
});

function fixElement(element, offset) {
var affixWaypoint = element.offset().top - offset;

$(window).scroll(function(event) {
var scrollPosition = $(window).scrollTop();

if(scrollPosition >= affixWaypoint) {
element.css('position', 'fixed');
element.css('top', offset + 'px');
} else {
element.css('position', 'relative');
element.css('top', '0');
}
});
}

/**
* Returns an array in the form of:
* [{
Expand All @@ -20,11 +35,14 @@ $(document).ready(function() {
* href: "#anchor",
* children: [...]
* }];
*
* @param {jQuery element} element The HTML element to create the outline from.
* @return {array} Array in the form described above.
*/
function createOutlineFromArticle(article) {
function createOutlineFromElement(element) {
var outline = [];

$('h2', article).each(function() {
$('h2', element).each(function() {
var item = {
title: $(this).not('a').text(),
href: $(this).find('a').attr('href') || "#",
Expand All @@ -48,27 +66,32 @@ function createOutlineFromArticle(article) {
}

/**
* Creates a nested list from an array in the form returned by `createOutlineFromArticle`.
* Creates a nested list from an array in the form returned by `createOutlineFromElement`.
*/
function createArticleNavigationFromOutline(outline) {
function createListFromItems(items) {
var ol = document.createElement('ol');
ol.class = "nav"

items.forEach(function(item) {
var a = document.createElement('a');
a.href = item.href;
a.appendChild(document.createTextNode(item.title));
/**
* Creates a nested list from an array in the form returned by `createOutlineFromElement`.
*
* @param {array} outline The outline from which to create a navigation list.
* @return {element} The HTML element containing the navigation list.
*/
function createArticleNavigationFromOutline(outline) {
var ol = document.createElement('ol');
ol.class = "nav"

var li = document.createElement('li');
li.appendChild(a);
li.appendChild(createListFromItems(item.children));
outline.forEach(function(item) {
var a = document.createElement('a');
a.href = item.href;
a.appendChild(document.createTextNode(item.title));

ol.appendChild(li);
});
var li = document.createElement('li');
li.appendChild(a);
if(item.children.length > 0) {
li.appendChild(createArticleNavigationFromOutline(item.children));
}

return ol;
}
ol.appendChild(li);
});

return createListFromItems(outline);
return ol;
}
105 changes: 75 additions & 30 deletions stylesheets/all.css

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 7 additions & 0 deletions stylesheets/all.css.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy