Bootstrap手风琴滚动行为崩溃 [英] Bootstrap accordion scrolling behaviour on collapse

查看:140
本文介绍了Bootstrap手风琴滚动行为崩溃的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用Bootstrap 3手风琴。
在阅读了许多关于如何对内容具有独立行为的帖子之后,我使用 data-target 和id(如果内容而不是默认值) strong> data-parent 。
独立折叠工作正常,但现在崩溃它滚动到可折叠项目的顶部。
如何禁用此滚动行为,同时保持可折叠的依赖关系?

I am using Bootstrap 3 accordion. After reading numerous posts on how to have independent behaviour on the contents, rather than keeping only one active by default, i use data-target and the id if the content instead of the default data-parent of the accordion id. The independent collapsing works fine, but now on collapse it scrolls to the top of the collapsible item. How can I disable this scrolling behaviour whilst keeping the collapsible in-dependancy?

推荐答案

我想我知道什么原因滚动问题。
如果您基于 getbootstrap.com 中显示的示例,则可以使用定位点

I think i know what causes the scrolling problem. If you are based on the example shown in getbootstrap.com, then you probably use anchors

<a data-toggle="collapse" data-content="#your-content" href="#your-content">...</a>

而不是锚点您可以使用跨度

instead of anchors you can use spans

<span data-toggle="collapse" data-content="#your-content">...<span>

锚中的href正在滚动。
我希望能帮助

The href in the anchor is causing the scroll. I hope that helps

这篇关于Bootstrap手风琴滚动行为崩溃的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆