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

Rounded values for some cases #58

Open
tibor opened this issue Jul 31, 2015 · 1 comment
Open

Rounded values for some cases #58

tibor opened this issue Jul 31, 2015 · 1 comment

Comments

@tibor
Copy link

tibor commented Jul 31, 2015

At first a big thanks for your work, buggyfill seems to work like expected on iPad and iPhone.

What would be really useful is an option to round the values in some cases to integers. I’m using vw mainly for grid layouts where it’s a good decision to get the exact value so that the sum of all divs is exactly 100vw.

But sometimes I’m using vmax for font-size or logos where a value of something like 26.208000000000002px doesn’t looks really nice. So it would be nice, if there was an option to set some values to integer (maybe through an additional content-value).

@rodneyrehm
Copy link
Owner

Good idea. Let me provide you with some details for implementing your feature:

  1. replaceValues() does the actual conversion, so this is likely the place you'd engage any hooks.
  2. You'd want to pass the property name from overwriteDeclaration{}
  3. you'd setup a map of callbacks, e.g. var defaultHooks = { "font-size": Math.floor }; somewhere at the top
  4. you'd add the initialization option "hooks" somewhere in initialize() in which you'd import the default hooks (3) and the user supplied hooks to options.hooks
  5. you'd run _number through the hook you were able to identify because of (2)

Good Luck :)

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

No branches or pull requests

2 participants