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

Prevent browsers from moving/blinking on initial click of anchor link #9

Merged
merged 2 commits into from
May 15, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
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
17 changes: 8 additions & 9 deletions Gruntfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ module.exports = function( grunt ) {
test: {
files: ['assets/js/test/**/*.js']
},

cssmin: {
options: {
banner: '/*! <%= pkg.title %> - v<%= pkg.version %> - <%= grunt.template.today("yyyy-mm-dd") %>\n' +
Expand All @@ -75,24 +75,24 @@ module.exports = function( grunt ) {
},
minify: {
expand: true,

cwd: 'assets/css/src/',
src: ['hash-link-scroll-offset.css'],

dest: 'assets/css/',
ext: '.min.css'
}
},
watch: {

styles: {
files: ['assets/css/src/*.css'],
tasks: ['cssmin'],
options: {
debounceDelay: 500
}
},

scripts: {
files: ['assets/js/src/**/*.js', 'assets/js/vendor/**/*.js'],
tasks: ['jshint', 'concat', 'uglify'],
Expand All @@ -108,13 +108,12 @@ module.exports = function( grunt ) {
grunt.loadNpmTasks('grunt-contrib-concat');
grunt.loadNpmTasks('grunt-contrib-uglify');
grunt.loadNpmTasks('grunt-contrib-cssmin');

grunt.loadNpmTasks('grunt-contrib-watch');

// Default task.

grunt.registerTask( 'default', ['jshint', 'concat', 'uglify', 'cssmin'] );


grunt.util.linefeed = '\n';
};
};
5 changes: 3 additions & 2 deletions assets/js/hash-link-scroll-offset.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/*! Hash Link Scroll Offset - v0.1.0 - 2015-04-24
/*! Hash Link Scroll Offset - v0.1.0 - 2015-05-15
* http://webdevstudios.com
* Copyright (c) 2015; * Licensed GPLv2+ */
/*jslint browser: true */
Expand All @@ -17,7 +17,8 @@ window.Hash_Link_Scroll_Offset = (function(window, document, $, undefined){
app.$html_and_body = $('html, body');

// Handle clicking hash links
$( 'a[href^="#"]:not(.no-scroll)' ).on( 'click', function() {
$( 'a[href^="#"]:not(.no-scroll)' ).on( 'click', function(event) {
event.preventDefault();
app.scrollToHash( this.hash );
});

Expand Down
4 changes: 2 additions & 2 deletions assets/js/hash-link-scroll-offset.min.js

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

3 changes: 2 additions & 1 deletion assets/js/src/hash-link-scroll-offset.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,8 @@ window.Hash_Link_Scroll_Offset = (function(window, document, $, undefined){
app.$html_and_body = $('html, body');

// Handle clicking hash links
$( 'a[href^="#"]:not(.no-scroll)' ).on( 'click', function() {
$( 'a[href^="#"]:not(.no-scroll)' ).on( 'click', function(event) {
event.preventDefault();
app.scrollToHash( this.hash );
});

Expand Down