![](https://img-blog.csdnimg.cn/20201014180756927.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
js
maoer9999
熟练掌握js,vue,nodejs,egg,熟悉go,小程序,ionic等,欢迎关注,互相学习
展开
-
js如何计算一个最合适的宽高在内容区域展示
1.首先获取父元素 的宽高parentWidth,parentHeight2. 如果知道子元素的宽高,或者子元素的宽高比例childWidth, childHeight3.如下计算子元素真实宽高let width,height;if (childWidth / childHeight > parentWidth/ parentHeight) { //当子元素宽大于父元素 width = parentWidth height = parseInt((parentW..原创 2021-04-28 10:46:17 · 360 阅读 · 2 评论 -
类似锚点的滚动实现
1.方式一:document.getElementById(selector).scrollIntoView()selector:指子选择器需要滚动的地方此方法简单,但是如果滚动的地方父组件也存在滚动,父组件也会滚动2.方式二:document.querySelector("#testList").scrollTop = document.getElementById(sele...原创 2020-03-10 11:18:44 · 212 阅读 · 2 评论 -
文字滚动
之前写的滚动的感觉不好,那个主要是当时用在项目当中的,现在重新写了个标题.box{ margin: 100px auto; width:1000px; height:50px; border: 1px solid red; border-radius: 10px; ...原创 2018-10-10 14:27:47 · 118 阅读 · 1 评论 -
解决输入框记住的(浏览器)密码回填到输入框问题
一,阻止回填1.<inputtype="text"name="password"onfocus="this.type='password'"autocomplete="off"/>2.autocomplete="new-password"3.autocomplete="nope"4.<input style='position:fixed;bottom:-...原创 2019-09-18 11:35:10 · 4162 阅读 · 3 评论