关闭Mac 双指左右滚动功能(浏览器前进、后退丢失页面)

本文介绍了如何在Mac系统中关闭所有浏览器的前进后退功能,包括全局设置和针对Chrome浏览器的终端命令调整,以及禁用Mac版Chrome的双指滚动手势。
摘要由CSDN通过智能技术生成

关闭所有浏览器的前进后退功能

系统偏好设置 => 触控板 => 更多手势 => 在页面之间轻扫

取消勾选即可。如下图所示:

仅关闭 Chrome 的前进后退功能

如果是 Chrome 浏览器,还可以使用下面这份方法

在终端输入执行下面两条命令,然后重启 Chrome,需要注意的是Chrome重启需要完全退出程序再打开,可按⌘+Q键退出,仅仅关闭窗口是不行的。

defaults write com.google.Chrome AppleEnableMouseSwipeNavigateWithScrolls -bool false
defaults write com.google.Chrome AppleEnableSwipeNavigateWithScrolls -bool FALSE

参考:

关闭Mac 双指左右滚动功能(浏览器前进、后退丢失页面)

禁用MAC版Chrome浏览器前进、后退手势的方法

  • 7
    点赞
  • 10
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
可以使用 `uni-app` 自带的 `movable-view` 组件来实现双指放大缩小的功能。 具体步骤如下: 1. 在 `template` 中添加 `movable-view` 组件,并设置 `scale` 属性为 1,`scale-min` 属性为 0.5,`scale-max` 属性为 2,`bindtouchstart`、`bindtouchmove`、`bindtouchend`、`bindtouchcancel` 四个事件的处理函数。 ```html <movable-view class="container" scale="1" scale-min="0.5" scale-max="2" bindtouchstart="handleTouchStart" bindtouchmove="handleTouchMove" bindtouchend="handleTouchEnd" bindtouchcancel="handleTouchEnd" > <!-- 可缩放内容 --> </movable-view> ``` 2. 在 `methods` 中定义四个事件处理函数。 ```javascript methods: { handleTouchStart(event) { // 记录起始触摸点距离 this.startDistance = this.getDistance(event.touches); }, handleTouchMove(event) { // 计算当前触摸点距离 const currentDistance = this.getDistance(event.touches); const scale = this.data.scale + (currentDistance - this.startDistance) / 100; // 更新缩放比例 this.setData({ scale }); // 更新起始触摸点距离 this.startDistance = currentDistance; }, handleTouchEnd() { // 限制缩放比例在指定范围内 let scale = this.data.scale; if (scale < this.data['scale-min']) { scale = this.data['scale-min']; } else if (scale > this.data['scale-max']) { scale = this.data['scale-max']; } this.setData({ scale }); }, handleTouchCancel() { // 取消触摸 this.handleTouchEnd(); }, getDistance(touches) { // 计算两个触摸点的距离 const x = touches[0].clientX - touches[1].clientX; const y = touches[0].clientY - touches[1].clientY; return Math.sqrt(x * x + y * y); } } ``` 其中,`handleTouchStart` 函数记录起始触摸点距离,`handleTouchMove` 函数计算当前触摸点距离,并根据距离变化计算新的缩放比例,`handleTouchEnd` 函数限制缩放比例在指定范围内,并更新缩放比例,`handleTouchCancel` 函数与 `handleTouchEnd` 函数类似,用于处理触摸取消的情况,`getDistance` 函数计算两个触摸点的距离。 注意:在 `movable-view` 组件中,`scale` 属性的值必须为字符串类型,因此需要使用 `setData` 方法更新缩放比例。

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值