-
Notifications
You must be signed in to change notification settings - Fork 79
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Unbalanced text flashes to balanced text #48
Comments
@bc173 Thanks for trying out the balance-text plugin and providing feedback. I'll have to think about that suggestion. I'd like to make that optional in case it causes problems for certain cases. Plugin currently automatically processes any element with The workaround for now is to use a different class (e.g. $('.balance-text-no-flash').balanceText(); If you get that working, please send me a link to a sample page and I'll look at merging that into this plugin. Or you could submit a pull request. Thanks. |
@bc173 I forgot to ask: are you using a web font? If so, then take a look at issue #45 . |
@bc173 You could also load global / layout scripts in the
When I have more time, I'd like to make a non-jQuery fork of Another alternative would be to add your own class to hide unbalanced text and remove / override it in a callback once |
Couldn't you just add a callback? Either a dev could hook into the callback to add an extra class that would make the text visible after the processing completes, or you could add an additional class automatically, such as "balance-text-done". |
I got here by searching issues for the keyword "callback". It seems like a callback would be ideal, allowing you to reveal the element after text is set. |
Thanks everyone for your interest in this project! @tannerhodges In case you didn't see the announcement, BalanceText v3 no longer depends on jQuery. @spruijtdesign @daveyjones To add more detail to the response by @tannerhodges above: The module can be called directly for advanced functionality. See How it works section for more details. For example, you can assign a custom class to your elements such as "my-balance-text" which hides your elements by default using
Hope this helps, |
@redmunds The solution you are suggesting doesn't work with elements added to the DOM after balancedText has been initialized. Not automatically at least. So if I add an "invisible" class to all my "balance-text" items and remove it on document ready I can generally avoid the flicker of unbalanced text, though this is still a poor solution since it doesn't guarantee that the balancing has finished before the class is removed. The addition of callback support would solve both these problem and better support separation of concerns. As is stand I'll need to hard code a call to balancedText into code that is dynamically adding elements to the page, or I just accept the flicker. A callback seems like the best solution for this type of tool. |
@spruijtdesign
Correct. If you call
All If you have a simple solution in mind then pull requests are welcome. |
I see the unbalanced text 'flash' to the balance text in a jarring way (takes like a split second). Would it be a good idea to modify the script, so that text is hidden first (or made transparent) and shows again after is has been balanced to avoid this jarring experience?
The text was updated successfully, but these errors were encountered: