twitter-bootstrap Bootstrap data-toggle , data-target & href 属性
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/25832665/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Bootstrap data-toggle , data-target & href attributes
提问by Lonwabo Mnyaiza
In bootstrap when I use the data-toggle & data-target attributes my href seems not to work does anyone know a way around this echo'Change'
在引导程序中,当我使用 data-toggle 和 data-target 属性时,我的 href 似乎不起作用有没有人知道解决此 echo'Change' 的方法
回答by HardScale
When data-target="link"and data-toggle="class"are set, bootstrap.js uses them to override the default href attribute. Setting the href to a static link will give a noscript browser something to go to.
当data-target="link"和data-toggle="class"被设置时,bootstrap.js 使用它们来覆盖默认的 href 属性。将 href 设置为静态链接将使 noscript 浏览器可以访问。
The standard HTML markup for an anchor tag is:
锚标记的标准 HTML 标记是:
<a href="link.html">LINK</a>
which is what a noscript browser will see, because it will ignore the data-* values.
这是 noscript 浏览器会看到的,因为它会忽略 data-* 值。
回答by Akshay Vijay Jain
For me there was no issue.
对我来说没有问题。
<div class="panel">
<a href="http://www.google.com" data-parent="#panel" data-toggle="collapse" data-target="#aa">Collapse</a>
<div id="aa" class="collapse in">aaaaaaaaaaaaaaaaaaaggggggggg hhhhhhhhhh iii ii jjjjjjj kkkkkkk lllllllllll lllllllll mmmmmm mmmm ooooop</div>
</div>
Here my anchor tag takes me to google.com after collapsing the #aa
在这里,我的锚标签在折叠后将我带到 google.com #aa

