Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
21 changes: 9 additions & 12 deletions garden.jade
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ html(lang=language)
// Navigation
nav(id='nav_main')
div
ul
ul
- each lang in languages
li(class=lang.id === language ? 'active' : '')
- if (lang.id === baseLanguage)
Expand Down Expand Up @@ -54,7 +54,7 @@ html(lang=language)

a(id='nav_next_section', href='#') next section
span(class='nav_section_name') section name

a(id='show_menu') show menu

// Sections
Expand All @@ -78,21 +78,18 @@ html(lang=language)
// Footer
footer
p Copyright ©. Built with
|
a(href='http://nodejs.org/') Node.js
| using a
a(href='https://github.com/visionmedia/jade/') jade
| template.
|
a(href='http://nodejs.org/') Node.js
| using a
a(href='https://github.com/visionmedia/jade/') jade
| template.

script(src='//ajax.googleapis.com/ajax/libs/jquery/1.5.1/jquery.min.js')

- if (language === baseLanguage)
script(src='javascript/prettify.js')
script(src='javascript/plugin.js')
script(src='javascript/garden.js')

- else
script(src='../javascript/prettify.js')
script(src='../javascript/plugin.js')
script(src='../javascript/garden.js')

45 changes: 16 additions & 29 deletions site/javascript/garden.js
Original file line number Diff line number Diff line change
Expand Up @@ -60,18 +60,18 @@ Sections.prototype = {
}
},

expand: function (sectionName) {
expand: function(sectionName) {
var nav = this.page.nav,
index = nav.find('a[href=#' + sectionName + ']')
.closest('nav > ul > li').index();

var height = this.page.window.height()
- $('nav > div').height()
- (33 * this.heights.length),
- (33 * this.heights.length);

sections = [],
currentHeight = 0,
distance = 0;
var sections = [],
currentHeight = 0,
distance = 0;

while ((currentHeight + this.heights[index]) < height) {
sections.push(index);
Expand Down Expand Up @@ -135,56 +135,43 @@ function Page() {
section: null,
articule: null
});

this.sections = new Sections(this);
this.init();
}

Page.prototype = {
init: function() {
var that = this,
mainNav = $('#nav_main');
$mainNav = $('#nav_main');

$.extend(this, {
scrollLast: 0,
resizeTimeout: null
});

this.window.scroll(function() {
that.onScroll();
});

this.window.resize(function() {
that.onResize();
});

that.sections.map();
this.sections.map();
setTimeout(function() {
that.sections.highlight();
}, 10);

// Mobile, for position: fixed
if ($.mobile) {
var navs = $('#nav_mobile, #nav_main');
navs.css('position', 'absolute');
this.window.scroll(function(){
navs.offset({
top: that.window.scrollTop()
});
});
}

// Show menu for tablets
$('#show_menu').click(function (){
var scrollTop = $.mobile ? that.window.scrollTop() : 0;

mainNav.slideDown(300).css('top', scrollTop);
// Show menu for tablets and smart phones
$('#show_menu').click(function() {
$mainNav.slideDown(300);
return false;
});
$('#nav_main').click(function(){

$mainNav.click(function() {
if(that.window.width() < 1000)
mainNav.slideUp(300, function() {this.removeAttr('style');});
$mainNav.slideUp(300, function() { $mainNav.removeAttr('style'); });
});
},

Expand Down
12 changes: 0 additions & 12 deletions site/javascript/plugin.js

This file was deleted.

4 changes: 2 additions & 2 deletions site/style/garden.css
Original file line number Diff line number Diff line change
Expand Up @@ -443,10 +443,10 @@ a abbr {

/* "Tablet" Styles */

@media screen and (max-width: 1000px) {
@media screen and (max-width: 999px) {
body {
width: 100%;
max-width: 1000px;
max-width: 999px;
overflow-x: hidden;
}

Expand Down