Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove jQuery #35

Merged
merged 7 commits into from
Mar 6, 2018
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Removed jQuery from index.js
  • Loading branch information
tomanistor committed Feb 18, 2018
commit 509b5a6525b05b1422cc4531bc705b80bd9c1ef5
1 change: 0 additions & 1 deletion static/scripts/index-9f7032a2.js

This file was deleted.

1 change: 1 addition & 0 deletions static/scripts/index-c3dc14c6.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

48 changes: 7 additions & 41 deletions static/scripts/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,26 +17,14 @@ var toggle = function(el) {
};

(function() {
// Nav starts at bottom then is fixed to top
// Logo and hamburger menus fade in and out
// $(window).scroll(function() {
// var scrollPosition = $(this).scrollTop();
// if( scrollPosition > $(this).height() - $("nav").height() ) {
// $("nav").addClass("nav-fixed");
// $("nav > div.logo").css('visibility','visible').fadeIn();
// $("nav > div.nav-toggle").css('visibility','visible').fadeIn();
// } else {
// $("nav").removeClass("nav-fixed");
// $("nav > div.logo").css('visibility','hidden').fadeOut();
// $("nav > div.nav-toggle").css('visibility','hidden').fadeOut();
// }
// });

// Nav starts at bottom then is fixed to top
// Logo and hamburger menus fade in and out
window.onscroll = function() {
var scrollPosition = this.scrollTop();
if (scrollPosition > this.innerHeight - parseInt(getComputedStyle('nav').height)) {
var scrollPosition = window.pageYOffset || document.documentElement.scrollTop;
var windowHeight = window.innerHeight || document.documentElement.clientHeight || document.body.clientHeight;
var navHeight = $('nav').clientHeight;

if (scrollPosition > windowHeight - navHeight) {
// Nav is fixed to top
$('nav').classList.add('nav-fixed');
$$('nav > .logo, nav > .nav-toggle').forEach(function(el) {
Expand Down Expand Up @@ -79,7 +67,7 @@ var toggle = function(el) {
function fullMobileViewport() {
var element = this;
var viewportHeight = window.innerHeight;
var heightChangeTolerance = 100; // Approximately URL bar height in Chrome
var heightChangeTolerance = 100; // Approximate address bar height in Chrome

$(window).resize(function () {
if (Math.abs(viewportHeight - window.innerHeight) > heightChangeTolerance) {
Expand All @@ -94,28 +82,6 @@ function fullMobileViewport() {

update();
}
$('header').forEach(function(el) {
$$('header').forEach(function() {
fullMobileViewport;
});


// Mobile browsers viewport height bug fix
// function fullMobileViewport() {
// var HEIGHT_CHANGE_TOLERANCE = 100; // Approximately URL bar height in Chrome
// var element = $(this);
// var viewportHeight = $(window).height();
//
// $(window).resize(function () {
// if (Math.abs(viewportHeight - $(window).height()) > HEIGHT_CHANGE_TOLERANCE) {
// viewportHeight = $(window).height();
// update();
// }
// });
//
// function update() {
// element.css("height", viewportHeight + "px");
// }
//
// update();
// }
// $("header").each(fullMobileViewport);