forked from Torone/GhosToro
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
32 changed files
with
1,522 additions
and
42 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
/** | ||
* Main JS file for GhosToro behaviours | ||
*/ | ||
|
||
/*globals jQuery, document */ | ||
(function ($) { | ||
"use strict"; | ||
|
||
$(document).ready(function(){ | ||
// Push down the blog at the beginning. | ||
var home = $('.home-template'); | ||
var centered = $('.v-center'); | ||
var t; | ||
|
||
if (home.length !== 0) { | ||
$(window).resize(function() { | ||
clearTimeout(t); | ||
t = setTimeout(setHeight(), 100); | ||
}); | ||
|
||
setHeight(); | ||
} | ||
|
||
function setHeight() { | ||
var headerHeight = $('#header').height(); | ||
var windowHeight = $(window).height(); | ||
var h = windowHeight - headerHeight; | ||
centered.css('height', h); | ||
} | ||
|
||
// Hide the "scroll down" text on scroll. | ||
var scrollDownText = $('.scroll-down'); | ||
|
||
$(window).scroll(function() { | ||
if ($(this).scrollTop() > 10) { | ||
scrollDownText.fadeOut(); | ||
} else if ($(this).scrollTop() === 0) { | ||
scrollDownText.fadeIn(); | ||
} | ||
}); | ||
|
||
// Add active class on navigation. | ||
var url = window.location.pathname; | ||
var navEl = $('#nav a'); | ||
var urlRegExp = new RegExp(url.replace(/\/$/,'') + "$"); | ||
|
||
navEl.each(function(){ | ||
if(urlRegExp.test(this.href.replace(/\/$/,''))) { | ||
$(this).addClass('active'); | ||
} | ||
}); | ||
|
||
// If blog images are larger than viewport set width to 100% to be responsive. | ||
var contentImages = $('.content img'); | ||
|
||
$(window).resize(function() { | ||
clearTimeout(t); | ||
t = setTimeout(setImgWidth(), 100); | ||
}); | ||
|
||
setImgWidth(); | ||
|
||
function setImgWidth() { | ||
var windowWidth = $(window).width(); | ||
if (contentImages.width() > windowWidth) { | ||
contentImages.css('width', '100%'); | ||
} else { | ||
contentImages.css('width', 'auto'); | ||
} | ||
} | ||
}); | ||
|
||
}(jQuery)); |
Large diffs are not rendered by default.
Oops, something went wrong.
Oops, something went wrong.