removed animated header and classie.js plugins and replaced with bootstrap affix to handle the collapsing menu bar

This commit is contained in:
David Miller 2016-06-22 15:35:40 -04:00
parent c60e29e934
commit fb65c10352
9 changed files with 40 additions and 174 deletions

View File

@ -209,17 +209,19 @@ fieldset[disabled] .btn-xl.active {
.navbar-default .navbar-nav > .active > a { .navbar-default .navbar-nav > .active > a {
border-radius: 3px; border-radius: 3px;
} }
.navbar-default.navbar-shrink { }
@media (min-width: 768px) {
.navbar-default.affix {
background-color: #222; background-color: #222;
padding: 10px 0; padding: 10px 0;
} }
.navbar-default.navbar-shrink .navbar-brand { .navbar-default.affix .navbar-brand {
font-size: 1.5em; font-size: 1.5em;
} }
} }
header { header {
background-image: url('../img/header-bg.jpg'); background-image: url('../img/header-bg.jpg');
background-repeat: none; background-repeat: no-repeat;
background-attachment: scroll; background-attachment: scroll;
background-position: center center; background-position: center center;
-webkit-background-size: cover; -webkit-background-size: cover;

7
css/agency.min.css vendored

File diff suppressed because one or more lines are too long

View File

@ -36,7 +36,7 @@
<body id="page-top" class="index"> <body id="page-top" class="index">
<!-- Navigation --> <!-- Navigation -->
<nav class="navbar navbar-default navbar-fixed-top"> <nav id="mainNav" class="navbar navbar-default navbar-fixed-top">
<div class="container"> <div class="container">
<!-- Brand and toggle get grouped for better mobile display --> <!-- Brand and toggle get grouped for better mobile display -->
<div class="navbar-header page-scroll"> <div class="navbar-header page-scroll">
@ -648,8 +648,6 @@
<!-- Plugin JavaScript --> <!-- Plugin JavaScript -->
<script src="http://cdnjs.cloudflare.com/ajax/libs/jquery-easing/1.3/jquery.easing.min.js"></script> <script src="http://cdnjs.cloudflare.com/ajax/libs/jquery-easing/1.3/jquery.easing.min.js"></script>
<script src="js/classie.js"></script>
<script src="js/cbpAnimatedHeader.js"></script>
<!-- Contact Form JavaScript --> <!-- Contact Form JavaScript -->
<script src="js/jqBootstrapValidation.js"></script> <script src="js/jqBootstrapValidation.js"></script>

View File

@ -4,23 +4,34 @@
* Licensed under MIT (https://github.com/BlackrockDigital/startbootstrap/blob/gh-pages/LICENSE) * Licensed under MIT (https://github.com/BlackrockDigital/startbootstrap/blob/gh-pages/LICENSE)
*/ */
(function($) {
"use strict"; // Start of use strict
// jQuery for page scrolling feature - requires jQuery Easing plugin // jQuery for page scrolling feature - requires jQuery Easing plugin
$(function() {
$('a.page-scroll').bind('click', function(event) { $('a.page-scroll').bind('click', function(event) {
var $anchor = $(this); var $anchor = $(this);
$('html, body').stop().animate({ $('html, body').stop().animate({
scrollTop: $($anchor.attr('href')).offset().top scrollTop: ($($anchor.attr('href')).offset().top - 50)
}, 1500, 'easeInOutExpo'); }, 1250, 'easeInOutExpo');
event.preventDefault(); event.preventDefault();
}); });
});
// Highlight the top nav as scrolling occurs // Highlight the top nav as scrolling occurs
$('body').scrollspy({ $('body').scrollspy({
target: '.navbar-fixed-top' target: '.navbar-fixed-top',
}) offset: 51
});
// Closes the Responsive Menu on Menu Item Click // Closes the Responsive Menu on Menu Item Click
$('.navbar-collapse ul li a:not(.dropdown-toggle)').click(function() { $('.navbar-collapse ul li a:not(.dropdown-toggle)').click(function() {
$('.navbar-toggle:visible').click(); $('.navbar-toggle:visible').click();
}); });
// Offset for Main Navigation
$('#mainNav').affix({
offset: {
top: 100
}
})
})(jQuery); // End of use strict

7
js/agency.min.js vendored
View File

@ -1,7 +0,0 @@
/*!
* Agency v1.0.7 (http://startbootstrap.com/template-overviews/agency)
* Copyright 2013-2016 Start Bootstrap
* Licensed under MIT (https://github.com/BlackrockDigital/startbootstrap/blob/gh-pages/LICENSE)
*/
$(function(){$("a.page-scroll").bind("click",function(a){var b=$(this);$("html, body").stop().animate({scrollTop:$(b.attr("href")).offset().top},1500,"easeInOutExpo"),a.preventDefault()})}),$("body").scrollspy({target:".navbar-fixed-top"}),$(".navbar-collapse ul li a:not(.dropdown-toggle)").click(function(){$(".navbar-toggle:visible").click()});

View File

@ -1,45 +0,0 @@
/**
* cbpAnimatedHeader.js v1.0.0
* http://www.codrops.com
*
* Licensed under the MIT license.
* http://www.opensource.org/licenses/mit-license.php
*
* Copyright 2013, Codrops
* http://www.codrops.com
*/
var cbpAnimatedHeader = (function() {
var docElem = document.documentElement,
header = document.querySelector( '.navbar-default' ),
didScroll = false,
changeHeaderOn = 220;
function init() {
scrollPage();
window.addEventListener( 'scroll', function( event ) {
if( !didScroll ) {
didScroll = true;
setTimeout( scrollPage, 250 );
}
}, false );
}
function scrollPage() {
var sy = scrollY();
if ( sy >= changeHeaderOn ) {
classie.add( header, 'navbar-shrink' );
}
else {
classie.remove( header, 'navbar-shrink' );
}
didScroll = false;
}
function scrollY() {
return window.pageYOffset || docElem.scrollTop;
}
init();
})();

View File

@ -1,11 +0,0 @@
/**
* cbpAnimatedHeader.min.js v1.0.0
* http://www.codrops.com
*
* Licensed under the MIT license.
* http://www.opensource.org/licenses/mit-license.php
*
* Copyright 2013, Codrops
* http://www.codrops.com
*/
var cbpAnimatedHeader=(function(){var b=document.documentElement,g=document.querySelector(".navbar-default"),e=false,a=220;function f(){d();window.addEventListener("scroll",function(h){if(!e){e=true;setTimeout(d,250)}},false)}function d(){var h=c();if(h>=a){classie.add(g,"navbar-shrink")}else{classie.remove(g,"navbar-shrink")}e=false}function c(){return window.pageYOffset||b.scrollTop}f()})();

View File

@ -1,80 +0,0 @@
/*!
* classie - class helper functions
* from bonzo https://github.com/ded/bonzo
*
* classie.has( elem, 'my-class' ) -> true/false
* classie.add( elem, 'my-new-class' )
* classie.remove( elem, 'my-unwanted-class' )
* classie.toggle( elem, 'my-class' )
*/
/*jshint browser: true, strict: true, undef: true */
/*global define: false */
( function( window ) {
'use strict';
// class helper functions from bonzo https://github.com/ded/bonzo
function classReg( className ) {
return new RegExp("(^|\\s+)" + className + "(\\s+|$)");
}
// classList support for class management
// altho to be fair, the api sucks because it won't accept multiple classes at once
var hasClass, addClass, removeClass;
if ( 'classList' in document.documentElement ) {
hasClass = function( elem, c ) {
return elem.classList.contains( c );
};
addClass = function( elem, c ) {
elem.classList.add( c );
};
removeClass = function( elem, c ) {
elem.classList.remove( c );
};
}
else {
hasClass = function( elem, c ) {
return classReg( c ).test( elem.className );
};
addClass = function( elem, c ) {
if ( !hasClass( elem, c ) ) {
elem.className = elem.className + ' ' + c;
}
};
removeClass = function( elem, c ) {
elem.className = elem.className.replace( classReg( c ), ' ' );
};
}
function toggleClass( elem, c ) {
var fn = hasClass( elem, c ) ? removeClass : addClass;
fn( elem, c );
}
var classie = {
// full names
hasClass: hasClass,
addClass: addClass,
removeClass: removeClass,
toggleClass: toggleClass,
// short names
has: hasClass,
add: addClass,
remove: removeClass,
toggle: toggleClass
};
// transport
if ( typeof define === 'function' && define.amd ) {
// AMD
define( classie );
} else {
// browser global
window.classie = classie;
}
})( window );

View File

@ -152,7 +152,12 @@ h1, h2, h3, h4, h5, h6 {
border-radius: 3px; border-radius: 3px;
} }
} }
.navbar-default.navbar-shrink { }
// Navbar Change on Scroll
@media(min-width:768px) {
.navbar-default.affix {
background-color: @gray-darkest; background-color: @gray-darkest;
padding: 10px 0; padding: 10px 0;
.navbar-brand { .navbar-brand {