scroll-view组件的scroll-into-view是否可以逆向操作?

小程序 文章 2021-03-04 12:21 730 0 全屏看文

AI助手支持GPT4.0

scroll-view组件的scroll-into-view是否可以逆向操作?Can the scroll-into-view of the scroll-view component be operated in reverse?

scroll-view组件的scroll-into-view是否可以逆向操作?

在做这样一个项目的时候,右边是一个scroll-view组件,给每一个标题盒子设置了不同的ID。在点击左边nav的选项的时候,利用scroll-into-view属性给他赋值相应的ID,右边可以滚动到相应的盒子,这是可以实现的。但是,在不点击左边选项的情况下,手动滚动右边的商品,在滚动到相应ID盒子的时候是否能监听到滚到哪个ID呢?我在@scroll里面没有找到,有是有ID字段,但是是空的值,我想请问一下是我姿势不对吗?还是说只能通过商品数量*高度去算滚到哪了?

When doing such a project, there is a scroll view component on the right, which sets different IDs for each title box. When you click the NAV option on the left, use the scroll into view attribute to assign the corresponding ID to it. You can scroll to the corresponding box on the right, which is realizable. However, without clicking the option on the left, if you manually scroll to the item on the right, can you monitor which id you scroll to when you scroll to the corresponding ID box? I didn't find it in @ scroll. There is an ID field, but it's an empty value. I want to ask if my posture is wrong? Or can we only calculate the roll by the quantity * height of goods?

回答:

年轻乄霸道:

创建一个 IntersectionObserver 对象实例,去监听所有要触发的事件!比较容易实现该功能。

官方文档 二楼@卢霄霄 已发!





默垂眸:

没有方法 只能自己计算

右边滑动获取当前滚动的高度 然后通过计算和左边的对应起来

-EOF-

AI助手支持GPT4.0


国内超级便宜服务器

摸鱼人热门新闻聚合

钻级赞助商 我要加入

开发者在线工具

第三方支付技术请加QQ群

相关文章
微信小游戏没有像小程序那样的组件(譬如按钮、view、复选框,对话框), 那要怎么实现呢?
小程序页面跳转url携带参数,参数能否为{{"a":1,"b":2}}这种对象类型?
请问游戏公测量在后台数据统计中归属于哪个访问来源?
公众号平台浏览器不能正常显示?
wx.navigateTo 跳转新页面onLoad截取
随便看看
将爱某艺的qsv转成flv格式放到老人点播机里 2479
和平精英战术随机应变、城区刚枪、野点发育、找车转移 是什么意思 8491
老爷子收到了057128256416的电话号码 3113
阿里云com、cn域名续费优惠码(2020年3月可用) 2863
线上防疫题库正确答案 2932
线上防疫题库正确答案(多选题) 4825
微信设置不可以使用小程序(游戏小程序) 5634
adsense申请已经支付的订单回退的网址 3212
BT面板查看网站入口、账号密码的命令 6009
ucloud海外服务器超级优惠券 3274