Skip to content

Instantly share code, notes, and snippets.

@tehsquidge
Last active December 29, 2015 10:49
Show Gist options
  • Save tehsquidge/7659044 to your computer and use it in GitHub Desktop.
Save tehsquidge/7659044 to your computer and use it in GitHub Desktop.
big fugging headers
(function($) {
$.bigHeader = function(element, options) {
var plugin = this;
plugin.settings = {}
var $element = $(element),
element = element;
var defaults = {
}
plugin.init = function() {
plugin.settings = $.extend({}, defaults, options);
}
plugin.resize = function() {
$(element).css('display','inline-block');
$(element).css('white-space', 'nowrap');
var parent_width = $(element).parent().width();
var percentage = parent_width/$(element).width();
$(element).css('font-size', Math.floor(parseInt($(element).css('font-size')) * percentage));
}
plugin.init();
}
$.fn.bigHeader = function(options) {
return this.each(function() {
if (undefined == $(this).data('bigHeader')) {
var plugin = new $.bigHeader(this, options);
$(this).data('bigHeader', plugin);
}
$(this).data('bigHeader').resize();
$(window).bind('resize.bigHeader', $(this).data('bigHeader').resize );
});
}
})(jQuery);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment