You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

index.js 600B

1234567891011121314151617181920
  1. jQuery.extend({
  2. UnitUtil: (function() {
  3. var pxWidth = 0;
  4. var tmpNode = document.createElement("DIV");
  5. tmpNode.style.cssText =
  6. "width:1mm;position:absolute;left:0px;top:0px;z-index:99;visibility:hidden";
  7. document.body.appendChild(tmpNode);
  8. pxWidth = tmpNode.getBoundingClientRect().width;
  9. tmpNode.parentNode.removeChild(tmpNode);
  10. return {
  11. mm2px: function (mm) {
  12. return parseFloat((mm * pxWidth).toFixed(0));
  13. },
  14. px2mm: function (px) {
  15. return parseFloat((px / pxWidth).toFixed(0));
  16. }
  17. };
  18. })()
  19. });