davatron5000 / FitText.js

A jQuery plugin for inflating web type
http://fittextjs.com
6.75k stars 1.39k forks source link

Can't get this to work #22

Closed bigonroad closed 12 years ago

bigonroad commented 12 years ago

Hey there.

Using the plugin on a wordpress theme that I'm building.

See it here: http://allaboutchris.org/blog/2012/bye-bye-blender/ - you can see the title hasn't resized.

My code is:

<script language="javascript" src="<?php bloginfo( 'stylesheet_directory' ); ?>/js/jquery.fittext.js" type="text/javascript"></script>
<script>
       jQuery("#resizeheadline").fitText();
</script>

What am I doing wrong?

Bless,
Chris
davatron5000 commented 12 years ago

It's not working becuase you're trying to execute fitText before the #resizeheadline has been loaded on the page. Just modify your code to wait for the document.ready()

jQuery(document).ready(function(){
  jQuery("#resizeheadline").fitText();
});
bigonroad commented 12 years ago

Yeh, I'm a tool. Working now!