Giter Site home page Giter Site logo

larryzhu-dev / autofit.js Goto Github PK

View Code? Open in Web Editor NEW
1.2K 6.0 130.0 42 KB

autofit.js 迄今为止最易用的自适应工具

Home Page: https://larryzhu-dev.github.io/autoLarryPages/autofit.js/

License: MIT License

JavaScript 100.00%
fit react self-adaption vue

autofit.js's People

Contributors

congwei614 avatar czq297297 avatar electroluxcode avatar larryzhu-dev avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

autofit.js's Issues

element-plus 弹窗异常

上次反映的 日历插件问题值不加拖拽功能就还好,这次这个 element-plus 就难受了。 弹窗后会造成页面右侧留白,element-ui 版本弹窗没有这个问题。
演示地址

我该使用 px 还是 % 开发?能使用 vh/rem 等相对单位吗?

根据readme中描述,使用autofit.js,能够自动的拉伸或者缩小,对于大屏开发来讲,的确解决了好多问题,这里有两个基础的地方不太明白:
根据设计稿进行页面开发,最外层容器的宽与高是用设计稿的像素还是百分比?还是两者兼可?
容器内部各个元素的宽高,以及padding,margin的值用像素还是百分比?css可定义的值太多了,px, rem ,vh/vw,em,这些在引用autofit.js的项目中,是可以混用,还是单纯便用px来统一开发?

添加地图拖拽不流畅

添加全局缩放之后,再加高德地图进去,拖拽感觉不够丝滑了,而且缩放也不是以鼠标所在位置开始缩放,是什么问题呀?

宽度和高度不能沾满

1704272634010
这个是我没有全屏的样子

1704272736991

这个是我全屏的样子

没有全屏的时候宽度没有沾满
全屏的时候高度没有沾满

fullCalendar 自适应失效

autofit.js 造成 fullCalendar 自适应异常,外部事件拖拽位置偏移
image

注释 autofit.init() 就正常

elRectification 方法,本地试了也没有用
演示地址

添加自定义容器

let clientHeight = document.documentElement.clientHeight;
let clientWidth = document.documentElement.clientWidth;

有些大屏页面可能并不是撑满浏览器的,比如有菜单栏,头部导航栏。
能不能增加自定义容器customContainer,如下

let container =document.querySelector(options.customContainer)
let clientHeight = container.clientHeight;
let clientWidth = container .clientWidth;

【bug】currelRectification参数未赋值

currelRectification参数未赋值导致空选择器
在off方法中调用的document.querySelectorAll(currelRectification)中并未用到传入的el参数也,会报错Uncaught DOMException: Failed to execute 'querySelectorAll' on 'Document': The provided selector is empty. at <anonymous>:1:27

Cannot read properties of undefined (reading 'isAutofitRunnig')

想通过elRectification来忽略地图容器,但是报错:Cannot read properties of undefined (reading 'isAutofitRunnig')

onMounted(() => {
  elRectification('#map');
});

使用ignore忽略地图容器,会造成地图显示不全,容器宽度设置的都是100%,请问使用elRectification是否可以解决这问题,不忽略的话地图会显得很模糊

antd的下拉框位置会错误

绑定Body后,Select的下拉弹窗位置错误了。如果不绑定body,绑定到body下面的元素,由于下拉框都是渲染到Body下的,下拉框又不会被缩放。

FullCalendar 插件自适应

1700795699977
使用 autofitjs 后FullCalendar 本身得高度宽度自适应会出现偏差,外部拖拽事件会发生偏移。使用 ignore和elRectification 方式也不大好使。
"@fullcalendar/vue3": "^6.1.9"
"autofit.js": "^3.0.6"
演示地址

autofit.js 无法支持任何以屏幕坐标为基准计算属性的第三方插件

如elementUI和各类UI库的弹出层,是基于屏幕坐标计算弹出层位置的,经过transform后,这些计算也会偏移,但是这些偏移是有迹可循的,一般是
鼠标移动距离左上角占真实屏幕的百分比 == 整个页面等比缩放后内部元素所在位置到左上角占缩放后元素的百分比

对此应该由第三方工具调整元素位置的计算策略,以真实的屏幕宽高计算元素位置,或者将弹出层以其父元素为基准偏移,并挂载在body内部。

出现留白

我配置后出现留白的情况呢
image
下面是我配置的代码:
image
下面是我的全局文件挂载的dom节点,也就是在 #root 上,
image
请大佬帮忙解惑呢

用了button按钮点击后会出现灰色遮罩

我是vue2项目,我在app组件上用了所有button按钮点击后会出现灰色遮罩
mounted() {
autofit.init(
{
dh: 1080,
dw: 1920,
el: "#routerview-box",
resize: true,
ignore: [
{
el: ".gaodeMap",
},
],
},
false
);
},
beforeDestroy() {
autofit.off();
},

我用了下面的形式就没有了,不知道上面的形式是什么原因
mounted() {
autofit.init({
designHeight: 1080,
designWidth: 1920,
renderDom: "#app",
resize: true,
});
},

beforeDestroy() {
	autofit.off();
},

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.