需求
css 隐藏滚动条
实现
1 | ::-webkit-scrollbar { |
写了一个意想不到的 bug,输出结果是[[0, 11], ......]
1 | let array = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11]; |
修复方法,简单的拷贝一下
1 | list.push([...test]); |
这个方法非常巧妙,把滚动条上下滚动改为了左右移动
https://dev.to/juanbelieni/how-to-create-horizontal-scroll-with-mouse-wheel-using-javascript-4cm5
https://css-tricks.com/snippets/jquery/horz-scroll-with-mouse-wheel/
https://stackoverflow.com/questions/11700927/horizontal-scrolling-with-mouse-wheel-in-a-div
https://stackoverflow.com/questions/12916289/how-to-trigger-javascript-mouse-scroll-wheel-on-a-divs-horizontal-scrollbar
1 | let element = document.querySelector('.recommendation-content'); |
1 | let father = document.querySelector('.recommendation-content'); |
用笨办法正则移除常见的中文标点符号
1 | str.replace( |
时间转换函数,挺好使的
1 | function GetTime (time) { |
这是建立在同源的前提下的
1 | <iframe v-if="$attrs.visible" ref="iframe" :src="iframeUrl" width="100%" height="100%" frameborder="0" :class="$style.iframe" @load="iframeLoaded" /> |
1 | // The real load method |
1 | <style module lang="scss"> |
记一下格式化时间算法
1 | function srtTimestamp(params) { |
记一下异常数据提取算法
1 | const outlierDetector = (collection) => { |
同一个浏览器打开多个页面,页面之间通信方法
1 | // 连接到广播频道 |