mirror of
https://github.com/paboyle/Grid.git
synced 2025-06-14 05:07:05 +01:00
Refactoring of the gh pages
This commit is contained in:
100
assets/js/_main.js
Normal file
100
assets/js/_main.js
Normal file
@ -0,0 +1,100 @@
|
||||
/* ==========================================================================
|
||||
jQuery plugin settings and other scripts
|
||||
========================================================================== */
|
||||
|
||||
$(document).ready(function(){
|
||||
|
||||
// Sticky footer
|
||||
var bumpIt = function() {
|
||||
$('body').css('margin-bottom', $('.page__footer').outerHeight(true));
|
||||
},
|
||||
didResize = false;
|
||||
|
||||
bumpIt();
|
||||
|
||||
$(window).resize(function() {
|
||||
didResize = true;
|
||||
});
|
||||
setInterval(function() {
|
||||
if(didResize) {
|
||||
didResize = false;
|
||||
bumpIt();
|
||||
}
|
||||
}, 250);
|
||||
|
||||
// FitVids init
|
||||
$("#main").fitVids();
|
||||
|
||||
// init sticky sidebar
|
||||
$(".sticky").Stickyfill();
|
||||
|
||||
var stickySideBar = function(){
|
||||
var show = $(".author__urls-wrapper button").length === 0 ? $(window).width() > 1024 : !$(".author__urls-wrapper button").is(":visible");
|
||||
// console.log("has button: " + $(".author__urls-wrapper button").length === 0);
|
||||
// console.log("Window Width: " + windowWidth);
|
||||
// console.log("show: " + show);
|
||||
//old code was if($(window).width() > 1024)
|
||||
if (show) {
|
||||
// fix
|
||||
Stickyfill.rebuild();
|
||||
Stickyfill.init();
|
||||
$(".author__urls").show();
|
||||
} else {
|
||||
// unfix
|
||||
Stickyfill.stop();
|
||||
$(".author__urls").hide();
|
||||
}
|
||||
};
|
||||
|
||||
stickySideBar();
|
||||
|
||||
$(window).resize(function(){
|
||||
stickySideBar();
|
||||
});
|
||||
|
||||
// Follow menu drop down
|
||||
|
||||
$(".author__urls-wrapper button").on("click", function() {
|
||||
$(".author__urls").fadeToggle("fast", function() {});
|
||||
$(".author__urls-wrapper button").toggleClass("open");
|
||||
});
|
||||
|
||||
// init smooth scroll
|
||||
$("a").smoothScroll({offset: -20});
|
||||
|
||||
// add lightbox class to all image links
|
||||
$("a[href$='.jpg'],a[href$='.jpeg'],a[href$='.JPG'],a[href$='.png'],a[href$='.gif']").addClass("image-popup");
|
||||
|
||||
// Magnific-Popup options
|
||||
$(".image-popup").magnificPopup({
|
||||
// disableOn: function() {
|
||||
// if( $(window).width() < 500 ) {
|
||||
// return false;
|
||||
// }
|
||||
// return true;
|
||||
// },
|
||||
type: 'image',
|
||||
tLoading: 'Loading image #%curr%...',
|
||||
gallery: {
|
||||
enabled: true,
|
||||
navigateByImgClick: true,
|
||||
preload: [0,1] // Will preload 0 - before current, and 1 after the current image
|
||||
},
|
||||
image: {
|
||||
tError: '<a href="%url%">Image #%curr%</a> could not be loaded.',
|
||||
},
|
||||
removalDelay: 500, // Delay in milliseconds before popup is removed
|
||||
// Class that is added to body when popup is open.
|
||||
// make it unique to apply your CSS animations just to this exact popup
|
||||
mainClass: 'mfp-zoom-in',
|
||||
callbacks: {
|
||||
beforeOpen: function() {
|
||||
// just a hack that adds mfp-anim class to markup
|
||||
this.st.image.markup = this.st.image.markup.replace('mfp-figure', 'mfp-figure mfp-with-anim');
|
||||
}
|
||||
},
|
||||
closeOnContentClick: true,
|
||||
midClick: true // allow opening popup on middle mouse click. Always set it to true if you don't provide alternative source.
|
||||
});
|
||||
|
||||
});
|
5
assets/js/main.min.js
vendored
Normal file
5
assets/js/main.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
82
assets/js/plugins/jquery.fitvids.js
Normal file
82
assets/js/plugins/jquery.fitvids.js
Normal file
@ -0,0 +1,82 @@
|
||||
/*jshint browser:true */
|
||||
/*!
|
||||
* FitVids 1.1
|
||||
*
|
||||
* Copyright 2013, Chris Coyier - http://css-tricks.com + Dave Rupert - http://daverupert.com
|
||||
* Credit to Thierry Koblentz - http://www.alistapart.com/articles/creating-intrinsic-ratios-for-video/
|
||||
* Released under the WTFPL license - http://sam.zoy.org/wtfpl/
|
||||
*
|
||||
*/
|
||||
|
||||
;(function( $ ){
|
||||
|
||||
'use strict';
|
||||
|
||||
$.fn.fitVids = function( options ) {
|
||||
var settings = {
|
||||
customSelector: null,
|
||||
ignore: null
|
||||
};
|
||||
|
||||
if(!document.getElementById('fit-vids-style')) {
|
||||
// appendStyles: https://github.com/toddmotto/fluidvids/blob/master/dist/fluidvids.js
|
||||
var head = document.head || document.getElementsByTagName('head')[0];
|
||||
var css = '.fluid-width-video-wrapper{width:100%;position:relative;padding:0;}.fluid-width-video-wrapper iframe,.fluid-width-video-wrapper object,.fluid-width-video-wrapper embed {position:absolute;top:0;left:0;width:100%;height:100%;}';
|
||||
var div = document.createElement("div");
|
||||
div.innerHTML = '<p>x</p><style id="fit-vids-style">' + css + '</style>';
|
||||
head.appendChild(div.childNodes[1]);
|
||||
}
|
||||
|
||||
if ( options ) {
|
||||
$.extend( settings, options );
|
||||
}
|
||||
|
||||
return this.each(function(){
|
||||
var selectors = [
|
||||
'iframe[src*="player.vimeo.com"]',
|
||||
'iframe[src*="youtube.com"]',
|
||||
'iframe[src*="youtube-nocookie.com"]',
|
||||
'iframe[src*="kickstarter.com"][src*="video.html"]',
|
||||
'object',
|
||||
'embed'
|
||||
];
|
||||
|
||||
if (settings.customSelector) {
|
||||
selectors.push(settings.customSelector);
|
||||
}
|
||||
|
||||
var ignoreList = '.fitvidsignore';
|
||||
|
||||
if(settings.ignore) {
|
||||
ignoreList = ignoreList + ', ' + settings.ignore;
|
||||
}
|
||||
|
||||
var $allVideos = $(this).find(selectors.join(','));
|
||||
$allVideos = $allVideos.not('object object'); // SwfObj conflict patch
|
||||
$allVideos = $allVideos.not(ignoreList); // Disable FitVids on this video.
|
||||
|
||||
$allVideos.each(function(count){
|
||||
var $this = $(this);
|
||||
if($this.parents(ignoreList).length > 0) {
|
||||
return; // Disable FitVids on this video.
|
||||
}
|
||||
if (this.tagName.toLowerCase() === 'embed' && $this.parent('object').length || $this.parent('.fluid-width-video-wrapper').length) { return; }
|
||||
if ((!$this.css('height') && !$this.css('width')) && (isNaN($this.attr('height')) || isNaN($this.attr('width'))))
|
||||
{
|
||||
$this.attr('height', 9);
|
||||
$this.attr('width', 16);
|
||||
}
|
||||
var height = ( this.tagName.toLowerCase() === 'object' || ($this.attr('height') && !isNaN(parseInt($this.attr('height'), 10))) ) ? parseInt($this.attr('height'), 10) : $this.height(),
|
||||
width = !isNaN(parseInt($this.attr('width'), 10)) ? parseInt($this.attr('width'), 10) : $this.width(),
|
||||
aspectRatio = height / width;
|
||||
if(!$this.attr('id')){
|
||||
var videoID = 'fitvid' + count;
|
||||
$this.attr('id', videoID);
|
||||
}
|
||||
$this.wrap('<div class="fluid-width-video-wrapper"></div>').parent('.fluid-width-video-wrapper').css('padding-top', (aspectRatio * 100)+'%');
|
||||
$this.removeAttr('height').removeAttr('width');
|
||||
});
|
||||
});
|
||||
};
|
||||
// Works with either jQuery or Zepto
|
||||
})( window.jQuery || window.Zepto );
|
72
assets/js/plugins/jquery.greedy-navigation.js
Normal file
72
assets/js/plugins/jquery.greedy-navigation.js
Normal file
@ -0,0 +1,72 @@
|
||||
/*
|
||||
* Greedy Navigation
|
||||
*
|
||||
* http://codepen.io/lukejacksonn/pen/PwmwWV
|
||||
*
|
||||
*/
|
||||
|
||||
var $nav = $('#site-nav');
|
||||
var $btn = $('#site-nav button');
|
||||
var $vlinks = $('#site-nav .visible-links');
|
||||
var $hlinks = $('#site-nav .hidden-links');
|
||||
|
||||
var breaks = [];
|
||||
|
||||
function updateNav() {
|
||||
|
||||
var availableSpace = $btn.hasClass('hidden') ? $nav.width() : $nav.width() - $btn.width() - 30;
|
||||
|
||||
// The visible list is overflowing the nav
|
||||
if($vlinks.width() > availableSpace) {
|
||||
|
||||
// Record the width of the list
|
||||
breaks.push($vlinks.width());
|
||||
|
||||
// Move item to the hidden list
|
||||
$vlinks.children().last().prependTo($hlinks);
|
||||
|
||||
// Show the dropdown btn
|
||||
if($btn.hasClass('hidden')) {
|
||||
$btn.removeClass('hidden');
|
||||
}
|
||||
|
||||
// The visible list is not overflowing
|
||||
} else {
|
||||
|
||||
// There is space for another item in the nav
|
||||
if(availableSpace > breaks[breaks.length-1]) {
|
||||
|
||||
// Move the item to the visible list
|
||||
$hlinks.children().first().appendTo($vlinks);
|
||||
breaks.pop();
|
||||
}
|
||||
|
||||
// Hide the dropdown btn if hidden list is empty
|
||||
if(breaks.length < 1) {
|
||||
$btn.addClass('hidden');
|
||||
$hlinks.addClass('hidden');
|
||||
}
|
||||
}
|
||||
|
||||
// Keep counter updated
|
||||
$btn.attr("count", breaks.length);
|
||||
|
||||
// Recur if the visible list is still overflowing the nav
|
||||
if($vlinks.width() > availableSpace) {
|
||||
updateNav();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// Window listeners
|
||||
|
||||
$(window).resize(function() {
|
||||
updateNav();
|
||||
});
|
||||
|
||||
$btn.on('click', function() {
|
||||
$hlinks.toggleClass('hidden');
|
||||
$(this).toggleClass('close');
|
||||
});
|
||||
|
||||
updateNav();
|
2049
assets/js/plugins/jquery.magnific-popup.js
Normal file
2049
assets/js/plugins/jquery.magnific-popup.js
Normal file
File diff suppressed because it is too large
Load Diff
8
assets/js/plugins/jquery.smooth-scroll.min.js
vendored
Normal file
8
assets/js/plugins/jquery.smooth-scroll.min.js
vendored
Normal file
@ -0,0 +1,8 @@
|
||||
/*!
|
||||
* jQuery Smooth Scroll - v1.7.2 - 2016-01-23
|
||||
* https://github.com/kswedberg/jquery-smooth-scroll
|
||||
* Copyright (c) 2016 Karl Swedberg
|
||||
* Licensed MIT
|
||||
*/
|
||||
|
||||
!function(a){"function"==typeof define&&define.amd?define(["jquery"],a):a("object"==typeof module&&module.exports?require("jquery"):jQuery)}(function(a){var b="1.7.2",c={},d={exclude:[],excludeWithin:[],offset:0,direction:"top",delegateSelector:null,scrollElement:null,scrollTarget:null,beforeScroll:function(){},afterScroll:function(){},easing:"swing",speed:400,autoCoefficient:2,preventDefault:!0},e=function(b){var c=[],d=!1,e=b.dir&&"left"===b.dir?"scrollLeft":"scrollTop";return this.each(function(){var b=a(this);if(this!==document&&this!==window)return!document.scrollingElement||this!==document.documentElement&&this!==document.body?void(b[e]()>0?c.push(this):(b[e](1),d=b[e]()>0,d&&c.push(this),b[e](0))):(c.push(document.scrollingElement),!1)}),c.length||this.each(function(){this===document.documentElement&&"smooth"===a(this).css("scrollBehavior")&&(c=[this]),c.length||"BODY"!==this.nodeName||(c=[this])}),"first"===b.el&&c.length>1&&(c=[c[0]]),c};a.fn.extend({scrollable:function(a){var b=e.call(this,{dir:a});return this.pushStack(b)},firstScrollable:function(a){var b=e.call(this,{el:"first",dir:a});return this.pushStack(b)},smoothScroll:function(b,c){if(b=b||{},"options"===b)return c?this.each(function(){var b=a(this),d=a.extend(b.data("ssOpts")||{},c);a(this).data("ssOpts",d)}):this.first().data("ssOpts");var d=a.extend({},a.fn.smoothScroll.defaults,b),e=function(b){var c=function(a){return a.replace(/(:|\.|\/)/g,"\\$1")},e=this,f=a(this),g=a.extend({},d,f.data("ssOpts")||{}),h=d.exclude,i=g.excludeWithin,j=0,k=0,l=!0,m={},n=a.smoothScroll.filterPath(location.pathname),o=a.smoothScroll.filterPath(e.pathname),p=location.hostname===e.hostname||!e.hostname,q=g.scrollTarget||o===n,r=c(e.hash);if(r&&!a(r).length&&(l=!1),g.scrollTarget||p&&q&&r){for(;l&&j<h.length;)f.is(c(h[j++]))&&(l=!1);for(;l&&k<i.length;)f.closest(i[k++]).length&&(l=!1)}else l=!1;l&&(g.preventDefault&&b.preventDefault(),a.extend(m,g,{scrollTarget:g.scrollTarget||r,link:e}),a.smoothScroll(m))};return null!==b.delegateSelector?this.undelegate(b.delegateSelector,"click.smoothscroll").delegate(b.delegateSelector,"click.smoothscroll",e):this.unbind("click.smoothscroll").bind("click.smoothscroll",e),this}}),a.smoothScroll=function(b,d){if("options"===b&&"object"==typeof d)return a.extend(c,d);var e,f,g,h,i,j=0,k="offset",l="scrollTop",m={},n={};"number"==typeof b?(e=a.extend({link:null},a.fn.smoothScroll.defaults,c),g=b):(e=a.extend({link:null},a.fn.smoothScroll.defaults,b||{},c),e.scrollElement&&(k="position","static"===e.scrollElement.css("position")&&e.scrollElement.css("position","relative"))),l="left"===e.direction?"scrollLeft":l,e.scrollElement?(f=e.scrollElement,/^(?:HTML|BODY)$/.test(f[0].nodeName)||(j=f[l]())):f=a("html, body").firstScrollable(e.direction),e.beforeScroll.call(f,e),g="number"==typeof b?b:d||a(e.scrollTarget)[k]()&&a(e.scrollTarget)[k]()[e.direction]||0,m[l]=g+j+e.offset,h=e.speed,"auto"===h&&(i=Math.abs(m[l]-f[l]()),h=i/e.autoCoefficient),n={duration:h,easing:e.easing,complete:function(){e.afterScroll.call(e.link,e)}},e.step&&(n.step=e.step),f.length?f.stop().animate(m,n):e.afterScroll.call(e.link,e)},a.smoothScroll.version=b,a.smoothScroll.filterPath=function(a){return a=a||"",a.replace(/^\//,"").replace(/(?:index|default).[a-zA-Z]{3,4}$/,"").replace(/\/$/,"")},a.fn.smoothScroll.defaults=d});
|
8
assets/js/plugins/stickyfill.min.js
vendored
Normal file
8
assets/js/plugins/stickyfill.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
5
assets/js/vendor/jquery/jquery-1.12.4.min.js
vendored
Normal file
5
assets/js/vendor/jquery/jquery-1.12.4.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user