-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
3878d08
commit 0fc0b48
Showing
6 changed files
with
79 additions
and
0 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
'use strict'; | ||
|
||
const gulp = require('gulp'); | ||
const sass = require('gulp-sass'); | ||
const htmlmin = require('gulp-htmlmin'); | ||
const autoprefixer = require('gulp-autoprefixer'); | ||
|
||
gulp.task('sass', function () { | ||
return gulp.src('./src/sass/style.scss') | ||
.pipe(sass({outputStyle: 'compressed'}).on('error', sass.logError)) | ||
.pipe(gulp.dest('./')); | ||
}); | ||
|
||
gulp.task('minify', function() { | ||
return gulp.src('./src/index.html') | ||
.pipe(htmlmin({collapseWhitespace: true, minifyJS: true})) | ||
.pipe(gulp.dest('./')); | ||
}); |
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
$(document).ready(function () { | ||
// Select all links with hashes | ||
$('a[href*="#"]') | ||
// Remove links that don't actually link to anything | ||
.not('[href="#"]') | ||
.not('[href="#0"]') | ||
.click(function (event) { | ||
// On-page links | ||
if ( | ||
location.pathname.replace(/^\//, '') === this.pathname.replace(/^\//, '') | ||
&& | ||
location.hostname === this.hostname | ||
) { | ||
// Figure out element to scroll to | ||
|
||
var target = $(this.hash); | ||
|
||
target = target.length ? target : $('[name=' + this.hash.slice(1) + ']'); | ||
// Does a scroll target exist? | ||
if (target.length) { | ||
// Only prevent default if animation is actually gonna happen | ||
|
||
event.preventDefault(); | ||
history.replaceState(null, null, document.location.pathname + this.hash); | ||
|
||
$('html, body').animate({ | ||
scrollTop: target.offset().top | ||
}, 600, function () { | ||
// Callback after animation | ||
// Must change focus! | ||
var $target = $(target); | ||
//$target.focus(); | ||
if ($target.is(':focus')) { // Checking if the target was focused | ||
return false; | ||
} else { | ||
$target.attr('tabindex', '-1'); // Adding tabindex for elements not focusable | ||
//$target.focus(); // Set focus again | ||
} | ||
}); | ||
} | ||
} | ||
}); | ||
}); |
Large diffs are not rendered by default.
Oops, something went wrong.