davatron5000 / FitText.js

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

Font-size #36

Closed disparvulgo closed 11 years ago

disparvulgo commented 12 years ago

I'm new in this people, so please don't shoot me. I'm working on a responsive website. The problem is that when I resize my window everything is allright. But then when I switch to another page in a resized window the font-size is in default. When I just move the resized window a tiny bit it switches back to the font-size it supossed to be.

Anyone???

ariestav commented 12 years ago

How are you invoking the fittext script? You should probably be doing it every time the page loads. With jQuery, place your code in $(document).ready(function{ }). Hope that helps!

-Arie

On Sep 5, 2012, at 11:49 AM, disparvulgo notifications@github.com wrote:

I'm new in this people, so please don't shoot me. I'm working on a responsive website. The problem is that when I resize my window everything is allright. But then when I switch to another page in a resized window the font-size is in default. When I just move the resized window a tiny bit it switches back to the font-size it supossed to be.

Anyone???

— Reply to this email directly or view it on GitHub.

robinscharf commented 12 years ago

I have a feeling that you're invoking fittext somewhere in the DOM tree that conflicts with another script or process. Are you using any other plugins or scripts?

disparvulgo commented 12 years ago

I also tried it with the $(document).ready(function{ }) with the same result. I'm using a responsive slider on the homepage. Allready big thanks for helping!

iamistad commented 11 years ago

Same issue. I'm using FitText inside of Flexslider. on page load the font size is really small. But upon inspection (firebug, chrome dev tools) and even resize, the font size value jumps to size proportionally to the window.

davatron5000 commented 11 years ago

So when you're using FitText inside of a slider, invisible elements have no height/width, so FitText can't make any calculations because there's no data or numbers to calculation. There's a few things you can do with regards to execution.

From a feature standpoint, I may include a custom fittext-resize event that you could trigger. But that's probably a bit off.

iamistad commented 11 years ago

Thanks for the support!

Callback via the slider to

start: function () {
$(window).trigger('resize'); 
}

Awesome plugin by the way ;)

ahmadajmi commented 10 years ago

If any one used it with siperslides this is how it works for me

$(document).on('animated.slides', function(a){
    setTimeout(function(){
        $('.fittext').fitText(1.78, { minFontSize: '16px', maxFontSize: '60px' });
    }, 100)
});

 $(document).on('animating.slides', function(a){
    setTimeout(function(){
        $('.fittext').fitText(1.78, { minFontSize: '16px', maxFontSize: '60px' });
    }, 100)
});
DevinWalker commented 9 years ago

@ahmadajmi thanks that saved me some time.