课程内的链接 list-group-item /链接本身/ 在 Twitter Bootstrap

/如何/ 我可以把一个链接放在靴子上 twitter "list-group-item", 哪个自己是参考,而不破坏格式 list-group-item? /见下文/


<div class="list-group">
<a class="list-group-item active" href="#">
<h4 class="list-group-item-heading">List group item heading</h4>
<p class="list-group-item-text">...</p>
<a href="[url=https://www.facebook.com/sharer/sharer.php?u=http"]https://www.facebook.com/share ... ot%3B[/url] target="_blank">
Share on Facebook
</a>
</a>
</div>
已邀请:

小姐请别说爱

赞同来自:

您不能使用标签
<a>

在其他标签里面
<a>

, 这是不可接受的 HTML. 退房
https://coderoad.ru/7863554/
问题。

但是,您可以点击 jQuery, 与这样的黑客一样:


HTML

- 而不是使用 div 来自用户类和一些数据标签:


<div class="list-group">
<div class="list-group-item active list-group-item-linkable" data-link="[url=http://www.google.com">]http://www.google.com">[/url]
<h4 class="list-group-item-heading">List group item heading</h4>
<p class="list-group-item-text">...</p>
<a href="[url=https://www.facebook.com/sharer/sharer.php?u=http"]https://www.facebook.com/share ... ot%3B[/url] target="_blank">

Share on Facebook
</a>
</div>
</div>



CSS

- 做它看起来像一个链接:


.list-group-item-linkable:hover {
color: #555;
text-decoration: none;
background-color: #f5f5f5;
cursor: pointer;
}



JS

- 最有趣的:


$/document/.ready/function// {
$/'.list-group-item-linkable'/.on/'click', function// {
// same window/tab:
window.location.href = $/this/.data/'link'/;

// new window/tab:
//window.open/$/this/.data/'link'//;
}/;

$/'.list-group-item-linkable a, .list-group-item-linkable button'/
.on/'click', function/e/ {
e.stopPropagation//;
}/;
}/;


我也创造了
http://jsfiddle.net/pdcmoreira/6ek29gr6/6/
.
</a></a>

喜特乐

赞同来自:

我很困惑,你希望所有这一切都是一个链接吗? 它可以采取更多步骤 - 什么都没有 copy-and-pasting 不能应对 - 但为什么简单地手动不提供标签 'a' 每个后代 "list-group"

要回复问题请先登录注册