gulp prod

This commit is contained in:
bchiang7
2016-12-08 23:34:45 -05:00
parent ea789e0928
commit ce307057a2
6 changed files with 2040 additions and 66 deletions

View File

@@ -1,34 +1,37 @@
$(function() {
const contentSections = $('.section');
const navigationItems = $('#dot-nav a');
const overlayItems = $('#overlay a');
$(window).on('scroll', () => { updateNavigation(); });
// ==================== VERTICAL NAV ==================== //
var contentSections = $('.section'),
navigationItems = $('#dot-nav a'),
overlayItems = $('#overlay a');
updateNavigation();
$(window).on('scroll', function() {
updateNavigation();
});
//smooth scroll to the section
navigationItems.on('click', event => {
navigationItems.on('click', function(event) {
event.preventDefault();
smoothScroll($(this.hash));
});
overlayItems.on('click', event => {
overlayItems.on('click', function(event) {
event.preventDefault();
smoothScroll($(this.hash));
$('#toggle').click();
});
// smooth scroll to second section
$('.scroll-down').on('click', event => {
$('.scroll-down').on('click', function(event) {
event.preventDefault();
smoothScroll($(this.hash));
});
// close navigation on touch devices when selectinG an elemnt from the list
$('.touch #dot-nav a').on('click', () => {
$('.touch #dot-nav a').on('click', function() {
$('.touch #dot-nav').removeClass('open');
});
// ==================== VERTICAL NAV ON SCROLL ==================== //
$(document).scroll( () => {
const x = $(window).width();
const y = $(this).scrollTop();
const $nav = $('#dot-nav');
$(document).scroll(function() {
var x = $(window).width();
var y = $(this).scrollTop();
var $nav = $('#dot-nav');
if (x > 768 && y > 500) {
$nav.fadeIn();
} else {
@@ -37,9 +40,9 @@ $(function() {
});
function updateNavigation() {
contentSections.each( () => {
const $this = $(this);
const activeSection = $('#dot-nav a[href="#' + $this.attr('id') + '"]').data('number') - 1;
contentSections.each(function() {
var $this = $(this);
var activeSection = $('#dot-nav a[href="#' + $this.attr('id') + '"]').data('number') - 1;
if (($this.offset().top - $(window).height() / 2 < $(window).scrollTop()) && ($this.offset().top + $this.height() - $(window).height() / 2 > $(window).scrollTop())) {
navigationItems.eq(activeSection).addClass('is-selected');
} else {
@@ -58,7 +61,7 @@ $(function() {
$('#overlay').toggleClass('open');
$('body').toggleClass('noScroll');
});
$(window).on('resize', event => {
$(window).on('resize', function(event) {
var windowWidth = $(window).width();
var isOpen = $('#overlay').hasClass('open');
@@ -74,7 +77,7 @@ $(function() {
});
// ==================== CONTACT FORM ==================== //
const $contactInput = $('.contact-input');
var $contactInput = $('.contact-input');
$contactInput.focus(function() {
$(this).parent().addClass('is-active is-completed');
});
@@ -85,12 +88,13 @@ $(function() {
$(this).parent().removeClass('is-active');
});
$(document).one('focus.textarea', '.autoExpand', () => {
const savedValue = this.value;
$(document).one('focus.textarea', '.autoExpand', function() {
var savedValue = this.value;
this.value = '';
this.baseScrollHeight = this.scrollHeight;
this.value = savedValue;
}).on('input.textarea', '.autoExpand', () => {
})
.on('input.textarea', '.autoExpand', function() {
var minRows = this.getAttribute('data-min-rows') | 0,
rows;
this.rows = minRows;
@@ -98,23 +102,23 @@ $(function() {
this.rows = minRows + rows;
});
const isMobile = {
Android() {
var isMobile = {
Android: function() {
return navigator.userAgent.match(/Android/i);
},
BlackBerry() {
BlackBerry: function() {
return navigator.userAgent.match(/BlackBerry/i);
},
iOS() {
iOS: function() {
return navigator.userAgent.match(/iPhone|iPad|iPod/i);
},
Opera() {
Opera: function() {
return navigator.userAgent.match(/Opera Mini/i);
},
Windows() {
Windows: function() {
return navigator.userAgent.match(/IEMobile/i);
},
any() {
any: function() {
return (isMobile.Android() || isMobile.BlackBerry() || isMobile.iOS() || isMobile.Opera() || isMobile.Windows());
}
};
@@ -129,11 +133,5 @@ $(function() {
forceHeight: false
});
}
});
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
})(window,document,'script','https://www.google-analytics.com/analytics.js','ga');
ga('create', 'UA-84377262-1', 'auto');
ga('send', 'pageview');
});