【发布时间】:2011-12-24 05:18:24
【问题描述】:
说明:
以下代码段在 Android/iPhone 中用于 Roundabout carousal。每个 LI 的宽度和高度为 100px x 100px。链接是 LI 的顶部。
<div data-role="content" data-theme="aa">
<ul class="roundabout-holder">
<li class="roundabout-moveable-item">
<a href="<%= url_for :action => :graph %>"> <%= label_for:link %></a></li>
<li class="roundabout-moveable-item">
<a href="<%= url_for :action => :graph %>"> <%= label_for:link %></a></li>
<li class="roundabout-moveable-item">
<a href="<%= url_for :action => :graph %>"> <%= label_for:link %></a></li>
<li class="roundabout-moveable-item">
<a href="<%= url_for :action => :graph %>"> <%= label_for:link %></a></li>
<li class="roundabout-moveable-item">
<a href="<%= url_for :action => :graph %>"> <%= label_for:link %></a></li>
</ul>
</div>
CSS
.roundabout-holder {
list-style: none;
width: 75%;
height: 10em;
margin: 1em auto;
}
.roundabout-moveable-item {
height: 100px;
width: 100px;
border: 1px dotted #999;
background-color: #f3f3f3;
font-size: 2em;
cursor: pointer;
}
当前行为: 在项目中,Anchor 仅充当链接(跳转到给定的参考)
预期行为: 当用户点击 LI 时,它应该跳转到给定的参考。
stackoverflow 中的相对资源
How do I make the whole area of a list item in my navigation bar, clickable as a link?
Make A List Item Clickable (HTML/CSS)
尽管解决方案接近我的问题。我需要找到通用解决方案。因为我不能一次或一个地为所有设置填充,因为链接标签可能会不时改变。
添加和测试如下
display:inline-block; 和 padding 然后问题已排序,但应不时更改填充。
【问题讨论】:
标签: jquery css jquery-mobile