我有一個導航欄,如下所示:在項目上的點擊添加工具提示在導航欄
<div data-role="navbar" class="custom-navbar" id="custom">
<ul>
<li onclick="product()"><a>Product Catalog<span></span></a></li>
<li onclick="item()"><a>Itemized Status<span></span> Check</a></li>
<li onclick="perish()"><a>Perishability Alerts<span></span></a></li>
<li onclick="stock()"><a>OSA Alerts<span></span></a></li>
</ul>
</div>
這是我的導航欄的代碼和我的CSS是
.custom-navbar ul li a {
background: #00a99d; Old browsers
background: linear-gradient(#00a99d,#00a99d) repeat scroll 0 0 #00a99d !important;
background: -moz-linear-gradient(#00a99d,#00a99d) repeat scroll 0 0 #00a99d !important; FF3.6+
background: -webkit-linear-gradient(#00a99d,#00a99d) repeat scroll 0 0 #00a99d !important; Chrome10+,Safari5.1+
background: -o-linear-gradient(#00a99d,#00a99d) repeat scroll 0 0 #00a99d !important; Opera 11.10+
background: -ms-linear-gradient(#00a99d,#00a99d) repeat scroll 0 0 #00a99d !important; IE10+
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#00a99d', endColorstr='#00a99d',GradientType=0); IE6-9
font-size: 16px;
font-family: Proxima Nova Bold;
color: white;
text-decoration:none;
}
.custom-navbar ul li a.ui-btn-active {
background: linear-gradient(#00897f, #00897f) repeat scroll 0 0 #00897f !important;
background: #67497a; Old browsers
background: linear-gradient(#00897f, #00897f) repeat scroll 0 0 #00897f !important; FF3.6+
background: -webkit-linear-gradient(#00897f, #00897f) repeat scroll 0 0 #00897f !important; Chrome10+,Safari5.1+
background: -o-linear-gradient(#00897f, #00897f) repeat scroll 0 0 #00897f !important; Opera 11.10+
background: -ms-linear-gradient(#00897f, #00897f) repeat scroll 0 0 #00897f !important; IE10+
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#00897f', endColorstr='#00897f',GradientType=0); IE6-9
font-size: 16px;
font-family: Proxima Nova Bold;
color: white;
text-decoration:none;
}
#custom a.clicked {
background-color: #red;
}
#custom ul {
text-align: center;
}
#custom ul li {
display: inline-block;
}
#custom ul a {
color: #fff;
padding: 5px;
background-color: #00a99d;
}
#custom ul a.clicked span {
left: 50%;
bottom: 2px;
display: block;
width: 0px;
height: 1px;
margin-left: -35px;
padding: 22px;
border-left: 1px solid transparent;
border-right: 1px solid transparent;
border-bottom: 1px solid #fff;
}
js文件是
$(document).ready(function(){
$('#custom ul li a').on('click', function() {
$('#custom ul li a ').removeClass('clicked');
$(this).addClass('clicked');
});
});
我想要這樣的東西,如圖所示。當我點擊導航欄中的項目時,我想添加一個工具提示。
這裏的代碼我越來越喜歡這個
誰能告訴我如何做到這一點
問候,
VHC
嗨Barnee我根據烏拉圭回合fiddle.I現在面臨的issue.All span元素也越來越隱蔽和編輯我的代碼在導航欄上沒有看到任何東西。 – user2542428
你是否也包含jQuery代碼?嘗試將其封裝在'jQuery(document).ready(function($){ \t });' –
如果將'a.clicked span'更改爲'a:hover span,a.clicked span',會發生什麼? [像這樣](http://jsfiddle.net/nzP57/3/)。跨度現在顯示在懸停上嗎? –