css:
.detail_row {
410px;
height: 34px;
clear: both;
border-bottom: 1px solid #eaeeef;
font-size: 14px;
position: relative;
}
.detail_row1 li{
float:left ;
102px;
text-align: center;
}
.detail_row>a{
display: inline-block;
/*padding: 0 25px;*/
color: #3eb7f3;
-webkit-transition: color .2s;
transition: color .2s;
}
.detail_line1{
position: absolute;
left: 0;
height: 3px;
0;
padding: 0;
background-color: #3eb7f3;
bottom: 0;
-webkit-transition: all .3s cubic-bezier(.4,0,.2,1);
transition: all .3s cubic-bezier(.4,0,.2,1);
}
html:
<ul class="detail_row" line-der>
<li><a href="#">全部</a></li>
<li><a href="#">已拒绝</a></li>
<li><a href="#">已上报</a></li>
<li><a href="#">待上报</a></li>
<a href="" class="detail_line1"></a>
</ul>
js:(注明需要自己创建controller)
.directive("lineDer",function(){
return{
restrict:'A',
link:function(scope,$element,$attrs){
var Li = angular.element(document.getElementsByClassName('detail_row')).find('li');
var wLi = Li[0].offsetWidth;
var Wa = angular.element(document.getElementsByClassName('detail_line1'));
for(var i=0;i<Li.lenght;i++){
Li[i].addEventLisener('click',functiton(e){
function(index){
Wa.css({wLi+'px',left:wLi*index+'px'})
}(i)
})
}
}
}
})