I use jQuery textFill to fit some dynamic text (from a database) into a div with predefined width.
My problem is that this plugin works great on a page, but i want to use it inside a twitter bootstrap modal. This doesn’t seem to work. I create an example in jsFiddle. I use a div outside of the modal and a div inside. The out-of-modal div works fine. The div inside seems to have some problems 🙂
<div id="out-of-modal"> <span>Lorem ipsum. Lorem ipsum.</span></div>
<div id="inside-modal"> <span>Lorem ipsum. Lorem ipsum.</span></div>
Here is the example in jsFiddle
Do you have any idea of what to do ?
2
Answers
The problem is with the css selector
hide
you used here, because it has propertydisplay:none
withimportant
ruleand causing not the modal to show, so remove it and also for transitioning effects use css selector
fade
if you likeSideNote: In your fiddle you are missing key div elements of modal e.g
<div class="modal-dialog">
and<div class="modal-content">
Working fiddle
I am really late to this thread, but I found a solution to this problem. In the actual script, there’s at some point this code
var ourText = $(Opts.innerTag + ':visible:first', this);
which basically tells jquery to pick the first
<span>
element inside our<div>
that is visible. However, our text is obviously not visible, because it’s inside the modal when the page is started, so it’s hidden. There’s a simple fix to this. Just go inside the library and edit that part into this and it should work perfectly: