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

小程序 文章 2021-03-04 12:21 646 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群

相关文章
请问,企业内部开发调用获取访问用户身份接口时,如何才能返回userID?
小程序MP后台取消第三方平台授权失败,提示系统系统异常,尝试几次都是一样的结果
onShareAppMessage分享页面获取不到参数?
微信小程序域名提示不合法怎么办?
getUserEncryptKey这个接口可以把openid这个限制去掉吗?
随便看看
微信公众号免300认证教程 5120
小程序已经上线,作为管理员无法在小程序数据助手查看数据? 4432
小程序广告组件通过审核,但是小程序内没有显示广告? 4404
企业微信通讯录账号被管理员误/恶意删除,怎么办? 8443
问题? 7667
如何快速搭建抽奖助手小程序(无需代码知识) 5229
许涛 大哥在吗, 要解冻小程序的时候提示信息主体不一致, 能帮忙看下吗? 6498
小程序搜一搜全称搜索不显示 麻烦解决一下!谢谢 5800
我的小程序广告收款主体是个体工商户,每个月邮寄两次发票很是麻烦,我年底的时候打包邮寄一次可以么? 5459
如何解决渲染层网络错误Failed to load media? 16708