1
Fork 0

Fix lint of creative JS

This commit is contained in:
Jake Howard 2016-05-20 22:32:51 +01:00
parent 7b50e8b606
commit cc240e2d4f
2 changed files with 61 additions and 60 deletions

View file

@ -4,41 +4,41 @@
* For details, see http://www.apache.org/licenses/LICENSE-2.0. * For details, see http://www.apache.org/licenses/LICENSE-2.0.
*/ */
(function($) { // jQuery for page scrolling feature - requires jQuery Easing plugin
"use strict"; // Start of use strict $('a.page-scroll').bind('click', function(event) {
const anchor = $(this);
$('html, body').stop().animate(
{
scrollTop: ($(anchor.attr('href')).offset().top - 50)
},
1250,
'easeInOutExpo'
);
event.preventDefault();
});
// jQuery for page scrolling feature - requires jQuery Easing plugin // Highlight the top nav as scrolling occurs
$('a.page-scroll').bind('click', function(event) { $('body').scrollspy({
var $anchor = $(this); target: '.navbar-fixed-top',
$('html, body').stop().animate({ offset: 51
scrollTop: ($($anchor.attr('href')).offset().top - 50) });
}, 1250, 'easeInOutExpo');
event.preventDefault();
});
// Highlight the top nav as scrolling occurs // Closes the Responsive Menu on Menu Item Click
$('body').scrollspy({ $('.navbar-collapse ul li a').click(function() {
target: '.navbar-fixed-top', $('.navbar-toggle:visible').click();
offset: 51 });
})
// Closes the Responsive Menu on Menu Item Click // Fit Text Plugin for Main Header
$('.navbar-collapse ul li a').click(function() { $('h1').fitText(
$('.navbar-toggle:visible').click(); 1.2, {
}); minFontSize: '35px',
maxFontSize: '65px'
}
);
// Fit Text Plugin for Main Header // Offset for Main Navigation
$("h1").fitText( $('#main-nav').affix({
1.2, { offset: {
minFontSize: '35px', top: 100
maxFontSize: '65px' }
} });
);
// Offset for Main Navigation
$('#main-nav').affix({
offset: {
top: 100
}
});
})(jQuery); // End of use strict

View file

@ -1,4 +1,3 @@
/*global jQuery */
/*! /*!
* FitText.js 1.2 * FitText.js 1.2
* *
@ -9,35 +8,37 @@
* Date: Thu May 05 14:23:00 2011 -0600 * Date: Thu May 05 14:23:00 2011 -0600
*/ */
(function( $ ){ $.fn.fitText = function( kompressor, options ) {
// Setup options
const compressor = kompressor || 1,
settings = $.extend({
'minFontSize' : Number.NEGATIVE_INFINITY,
'maxFontSize' : Number.POSITIVE_INFINITY
}, options);
$.fn.fitText = function( kompressor, options ) { return this.each(function() {
// Setup options // Store the object
var compressor = kompressor || 1, var $this = $(this);
settings = $.extend({
'minFontSize' : Number.NEGATIVE_INFINITY,
'maxFontSize' : Number.POSITIVE_INFINITY
}, options);
return this.each(function(){ // Resizer() resizes items based on the object width divided by the compressor * 10
var resizer = function () {
$this.css('font-size',
Math.max(
Math.min(
$this.width() / (compressor * 10),
parseFloat(settings.maxFontSize)
),
parseFloat(settings.minFontSize))
);
};
// Store the object // Call once to set.
var $this = $(this); resizer();
// Resizer() resizes items based on the object width divided by the compressor * 10 // Call on resize. Opera debounces their resize by default.
var resizer = function () { $(window).on('resize.fittext orientationchange.fittext', resizer);
$this.css('font-size', Math.max(Math.min($this.width() / (compressor*10), parseFloat(settings.maxFontSize)), parseFloat(settings.minFontSize)));
};
// Call once to set. });
resizer();
// Call on resize. Opera debounces their resize by default. };
$(window).on('resize.fittext orientationchange.fittext', resizer);
});
};
})( jQuery );