diff options
author | Noah Jewell <njewe42@tscstudents.net> | 2017-04-11 19:42:43 +0000 |
---|---|---|
committer | Noah Jewell <njewe42@tscstudents.net> | 2017-04-11 19:42:43 +0000 |
commit | 505c8e6d6eb311ec319d02c143c349ea2413b32d (patch) | |
tree | 1a4ed82abf4315dae262b3a9352b1a92f2b913d8 | |
parent | 106181b67dcb85ddcbdcfe773a463a5fb6002369 (diff) |
Upload new file
-rw-r--r-- | js/clean-blog.js | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/js/clean-blog.js b/js/clean-blog.js new file mode 100644 index 0000000..26a60cc --- /dev/null +++ b/js/clean-blog.js @@ -0,0 +1,40 @@ +// Floating label headings for the contact form +$(function() { + $("body").on("input propertychange", ".floating-label-form-group", function(e) { + $(this).toggleClass("floating-label-form-group-with-value", !!$(e.target).val()); + }).on("focus", ".floating-label-form-group", function() { + $(this).addClass("floating-label-form-group-with-focus"); + }).on("blur", ".floating-label-form-group", function() { + $(this).removeClass("floating-label-form-group-with-focus"); + }); +}); + +// Navigation Scripts to Show Header on Scroll-Up +jQuery(document).ready(function($) { + var MQL = 1170; + + //primary navigation slide-in effect + if ($(window).width() > MQL) { + var headerHeight = $('.navbar-custom').height(); + $(window).on('scroll', { + previousTop: 0 + }, + function() { + var currentTop = $(window).scrollTop(); + //check if user is scrolling up + if (currentTop < this.previousTop) { + //if scrolling up... + if (currentTop > 0 && $('.navbar-custom').hasClass('is-fixed')) { + $('.navbar-custom').addClass('is-visible'); + } else { + $('.navbar-custom').removeClass('is-visible is-fixed'); + } + } else if (currentTop > this.previousTop) { + //if scrolling down... + $('.navbar-custom').removeClass('is-visible'); + if (currentTop > headerHeight && !$('.navbar-custom').hasClass('is-fixed')) $('.navbar-custom').addClass('is-fixed'); + } + this.previousTop = currentTop; + }); + } +}); |