question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Getting auto scaleable text working using BigText.js

See original GitHub issue

This javascript library https://github.com/zachleat/BigText calculates the width of a line of text and scales text accordingly. (See this demo to get the idea: https://zachleat.github.io/BigText/demo/wizard.html)

Really having trouble implementing this. Just to get it going, I am using $('#h1').bigtext(); to try to catch all h1 headers in the slide. Tried it both inline like so:

!SLIDE

# HELLO HELLO HELLO

<script>
$('#h1').bigtext();
</script>

And by putting the javascript in a .js file in the directory of the slideshow. No luck, can’t get it to fire. Any ideas?

Why is this important? Personally, my style of slideshow has lots of one word, or one sentence slides in big text. This means a slideshow template can have the largest text possible for each “headline” on the slide.

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:10 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
binford2kcommented, Dec 19, 2016

Bigtext doesn’t work on individual elements, it works on containers of elements. (a div, p, ol, li, etc)

Here are a few things that work, play with them and see what works best.

Everything:

$('.content').bigtext()`

Only headers:

$('.content').bigtext({
    childSelector: '> h1'
})

A slide with a specific title:

$('#Introduction_Section').bigtext()

Only slides marked with a specific class (e.g. <!SLIDE bigly>):

$('.bigly').bigtext()

I’m not closing this ticket yet, because I think I might experiment with incorporating this library into core to support specifically the use case you describe.

0reactions
slambertcommented, Dec 23, 2016

Ha, I’m terrible when it comes to that – not something I’ve tested for in years!

I don’t have a machine I can test it with either, so maybe someone reading this can jump in and help out?

Read more comments on GitHub >

github_iconTop Results From Across the Web

Make text fit its parent size using JavaScript
Automatically resizing a text to its parent container can be a big struggle and it becomes nearly impossible if you aim to use...
Read more >
text auto font size - javascript - Stack Overflow
If it is, you decrease the font size and check again until it fits. I would probably hide the title div until I...
Read more >
text-size-adjust - CSS: Cascading Style Sheets - MDN Web Docs
The text-size-adjust CSS property controls the text inflation algorithm used on some smartphones and tablets. Other browsers will ignore this property.
Read more >
Fitting Text to a Container | CSS-Tricks
It's another JavaScript library that adjusts font sizes to fit text into a container. Big caveat here though: textFit is designed for two- ......
Read more >
How to change font size depending on width of container?
Using CSS property (Viewport width): The vw is a CSS property, to create responsive typography in the HTML file. The viewport is a...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found