Skip to content
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

Add optional callback to the settings object. #160

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

DanielJohnsson87
Copy link

I'v added a callback to the settings object. It will run once the $.each functions is done.

@davatron5000
Copy link
Owner

Hey thanks for contributing! What's the usecase for this? That callback could get called thousands of times onresize.

@DanielJohnsson87
Copy link
Author

Sorry for the bad explanation.

The usecase for me was to add a class to the elements effected after page load once the elements font-size is set. To prevent flash of unstyled content I've hidden all titles and in the callback I will add a animate-in/show css class to display the titles after the correct font-size is set.

I'm aware that the callback would run on every 'onresize'-event and I'm handling that on my side. But it didn't make much sense to add a callback to the plugin if it only fires sometimes.

Perhaps adding a variable to the callback to control if the callback should run once or every time could be a solution? The default being that the callback only runs one time?

@davatron5000
Copy link
Owner

Ah. I think I sorta understand. Might be kinda niche to your implementation. The need for a callback hasn't come up much in the last 5yrs. Do you have a CodePen or something showing what you're doing? I want to be sure I understand it completely.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants