美文网首页
H5页面,在IOS溢出滚动卡顿、滑动不了兼容问题处理

H5页面,在IOS溢出滚动卡顿、滑动不了兼容问题处理

作者: 码农私房菜 | 来源:发表于2022-02-23 10:26 被阅读0次
import React, { FC, useEffect } from 'react'

import { useSelector } from 'react-redux'

import './index.less'

interface IProps {
    paramsType: number | string
}
const FooterPopUp: FC<IProps> = (props: IProps) => {
    const { data } = useSelector((state: any) => state.addOrEditDevice)

    const { paramsType } = props

    const disableSystemScrolling = (type: boolean, cls: string) => {
        const htmlEl = document.querySelector('html')
        const bodyEl = document.querySelector('body')
        if (type) {
            htmlEl!.classList.add(cls)
            bodyEl!.classList.add(cls)
        } else {
            htmlEl!.classList.remove(cls)
            bodyEl!.classList.remove(cls)
        }
    }

    useEffect(() => {
        try {
            disableSystemScrolling(true, 'disableSystemScrolling')
        } catch (error) {}
        return () => {
            // 没有删除功能
            disableSystemScrolling(false, 'disableSystemScrolling')
            // confirmAlert && confirmAlert.removeElementReconfirm()
        }
    }, [])
    if (paramsType < 80) return null
    return (
        <div className="add-edit-device-wrap-pop">
            <div className="add-edit-device-pop">
                <ul className="add-edit-device-pop-ul">
                    <li>1</li>
                    <li>2</li>
                    <li>3</li>
                    <li>4</li>
                    <li>5</li>
                    <li>6</li>
                    <li>7</li>
                    <li>8</li>
                    <li>9</li>
                    <li>10</li>
                    <li>11</li>
                    <li>12</li>
                    <li>13</li>
                    <li>14</li>
                    <li>15</li>
                    <li>16</li>
                    <li>17</li>
                    <li>18</li>
                    <li>19</li>
                    <li>20</li>
                </ul>
            </div>
            <div className={'add-edit-device-pop-title'}>
                <div className={'add-edit-device-pop-title-text'}>请选择</div>
            </div>
            <div className={'add-edit-device-pop-footer'}>
                <div className={'add-edit-device-pop-footer-text'}>保存</div>
            </div>
        </div>
    )
}

export default FooterPopUp

@import '~@/assets/css/mixin.less';
@heightH: 700px;
@heightFooter: 100px;
@widthW: 750px;

.add-edit-device-wrap-pop {
    width: 70%;
    height: 100vh;
    z-index: 99;
    position: fixed;
    bottom: 0;
    background: #54ff4e33;
    overflow: hidden;
    overflow-y: scroll;

    .add-edit-device-pop {
        width: 50%;
        min-height: 100%;
        padding: @heightH 36px 0px;
        background: #f34d4d;
        .add-edit-device-pop-ul {
            height: calc(100vh - @heightH - @heightFooter);
            background: rgb(128, 127, 127);
            overflow: hidden;
            overflow-y: scroll;
            li {
                margin-bottom: 30px;
                height: 150px;
                background: rgb(68, 71, 250);
            }
        }
    }
    .add-edit-device-pop-title {
        position: fixed;
        left: 0;
        top: 0;
        background: rgb(74, 207, 248);
        display: flex;
        justify-content: center;
        align-items: flex-end;
        width: 30%;
        height: @heightH;
        .add-edit-device-pop-title-text {
            // position: absolute;
            // left: 0;
            // bottom: 0;
            width: 100%;
            height: 100px;
            background: #fff;
        }
    }
    .add-edit-device-pop-footer {
        width: @widthW;
        height: @heightFooter;
        position: fixed;
        left: 0;
        bottom: 0;
        background: rgb(252, 40, 199);
        display: flex;
        justify-content: center;
        align-items: center;
    }
}
.disableSystemScrolling {
    position: fixed;
    left: 0;
    top: 0;
    width: 100vw;
    min-height: 100vh;
    overflow-y: scroll;
    background: #3695f5;
}

相关文章

  • 前端面试题

    IOS和安卓常见兼容问题 1.IOS下input默认样式(圆角、阴影) 解决方案: 2.在IOS下页面滑动卡顿,A...

  • IOS滚动卡顿及点击失效问题

    IOS滚动卡顿 IOS中使用H5页面,并且H5页面中不适合使用IOS系统的滚动效果时。例如某个div中添加了ove...

  • H5移动端开发问题及解决方法

    一、iOS 滑动不流畅 上下滑动页面时会产生卡顿,手指离开页面后,页面立即停止运动。 解决方法: 在 iOS 5....

  • 搜索列表研发遇见的问题

    . 背景: h5页面嵌入app,框架vue2.0 ios中文输入法监听不到键盘事件 解决ios滑动卡顿

  • 分享踩坑点

    大多数人都会遇到的几个兼容性坑 1、ios端微信h5页面上下滑动时卡顿、页面缺失+ios键盘唤起,键盘收起以后页面...

  • iOS卡顿

    iOS解决滑动页面卡顿的基本技巧 1 卡顿现象一 在使用CADisplaylink 的时候,它的执行和屏幕刷新率(...

  • 2021-03-04

    移动的端常见问题 ios滑动不流畅 上下滑动页面会产生卡顿,手指离开页面,页面立即停止运动。整体表现就是滑动不流畅...

  • H5页面在app端滑动,显示问题

    H5页面在IOS上滑动问题 IOS本身有个特性为弹性滑动,如果IOSAPP开启此功能,会造成H5页面中,底部固定定...

  • ios 系统滑动问题

    iOS 中页面如果出现滚动条后,滑动浏览内容时会感觉特别卡,在移动设备上体验很不好 方案一 css代码中,需要滑动...

  • 手机端页面在项目中遇到的一些问题及解决办法

    1.解决页面使用overflow: scroll在iOS上滑动卡顿的问题? 首先你可能会给页面的html和body...

网友评论

      本文标题:H5页面,在IOS溢出滚动卡顿、滑动不了兼容问题处理

      本文链接:https://www.haomeiwen.com/subject/edrzlrtx.html