npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@fekit/mc-scale

v1.0.6

Published

scale内核的自适应解决方案,这个方案在一些特殊场景下使用。在大多数场景下建议使用https://www.npmjs.com/package/@fekit/mc-ratio

Downloads

0

Readme

MC-SCALE

scale 内核的自适应解决方案,这个方案在一些特殊场景下使用。在大多数场景下建议使用 https://www.npmjs.com/package/@fekit/mc-ratio

索引

演示

安装

npm i @fekit/mc-scale

参数

    {
        el   : 'id',               {DomObject}   要缩放的DOM对象
        size : [750, 1334],        {Number}      设计稿的尺寸
        full : true | false,       {Boolean}     是否开启全屏模式?如果开启开屏模式则对宽度和高度双向自适应 *
        fixed: 2                   {Number}      设置字号精度为小数点后2,一般建议为2位
        max  : 750                 {Number}      最大尺寸,超过这个尺寸不再放大
        min  : 320                 {Number}      最小尺寸,超过这个尺寸不再缩小
        then : function () {}      {Function}    自适应字号改变时的回调
    }

示例

基础自适应:

scale({
  el: document.getElementId('area'),
  size: [750, 1334] // 设计稿的尺寸
});

双向自适应:

scale({
  el: document.getElementId('area'),
  size: [750, 1334], // 设计稿的尺寸
  full: true, // 开启全屏模式,将对宽度和高度双向自适应缩放,这种模式一般用于无滚动条的全屏页面。
  fixed: 2 // 设置字号精度为小数点后2位
});

限制最大尺寸:

scale({
  el: document.getElementId('area'),
  size: [750, 1334], // 设计稿的尺寸
  full: true, // 开启全屏模式,将对宽度和高度双向自适应缩放,这种模式一般用于无滚动条的全屏页面。
  max: 750 // 超过750的尺寸不再放大
});

局部自适应

// 以下示例仅对指定ID为area的元素做自适应,需要注意的是,如果你仅对网页中的部分区域做自适应,请勿开启dpr功能,该功能将影响全局网页
scale({
  el: document.getElementId('area'), // 为ID为area的标签设置自适应字号,当字号不是设置在HTML根标签时,只能在区域内用em方案自适应
  size: [750, 1334], // 设计稿的尺寸
  fixed: 2
});

版本

v1.0.5 [Latest version]
1、非功能性升级
v1.0.4
1、非功能性升级
v1.0.3
1、添加min和max属性,大于或小于某个值后不再缩放
v1.0.0
1、由@fekit/mc-ratio修改而成。继承了@fekit/mc-ratio的所有入参及功能