Last active
December 29, 2015 10:49
-
-
Save tehsquidge/7659044 to your computer and use it in GitHub Desktop.
big fugging headers
This file contains hidden or 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
(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