Sample Code for angularjs to implement timeline effects, and angularjs sample code
1. Import package
Introduce the angular-timeline package.
: Angular-timeline.zip
Introduce in index.html
<link href="lib/angular-timeline/dist/angular-timeline.css" rel="external nofollow" rel="stylesheet"><script src="lib/angular-timeline/dist/angular-timeline.js"></script>
If it is referenced in app. js, it will be ineffective if it is not referenced.
2. Rewrite css
Rewrite css as needed, and rewrite the core part.
You can either write it in style.css or create a new cssfile, but it must be referenced in index.html.
/* Timeline */. timeline-event {margin-bottom: 0px! Important;} The timeline-badge.infos {background-color: # 47d09e! Important;}. timeline: before {width: 1px! Important; left: 24px! Important; margin-top: 30px! Important; background-color: # 47d09e! Important;} timeline-badge {left: 16px! Important; width: 15px! Important; height: 15px! Important; top: 15px! Important; box-shadow: none! Important;} timeline-panel {float: left! Important; width: 85%! Important; padding: 13px 0px 6px 0px! Important; margin-left: 39px! Important; background: none! Important; border: none! Important; box-shadow: none! Important;} timeline-panel: before {visibility: hidden! Important;} timeline-panel: after {visibility: hidden! Important; display: none! Important;} timeline-panel. time {font-size: 14px; font-family: 'pingfangsc-Regular ';} timeline-panel. detail {display: flex; display:-webkit-flex; align-items: center;-webkit-align-items: center; justify-content: space-; -webkit-justify-content: space-between; margin-top: 10px;} timeline-panel. detail. linename {font-size: 16px; max-width: 80%; color: # 1c1c1c; display: inline-block; font-family: 'pingfangsc-Medium ';} timeline-panel. detail. linelevel {position: absolute; right: 18%; border-radius: 4px; color: white; padding: 1px 5px 1px 5px; font-size: 11px;} timeline-panel. detail. linelevel-g {background-color: # f27373;} timeline-panel. detail. linelevel-p {background-color: # e29431;} timeline-panel. detail. linenum {float: right; font-size: 14px; color: #323232 ;}
Page 3
The preparation is complete. The following is the compilation of the page.
<! -- Html page --> <ion-view-title = "{title}"> <ion-content scroll = "true"> <timeline-event ng- repeat = "event in teamDataList" side = "right"> <timeline-badge class = "infos"> </timeline-badge> <timeline-panel class = "infos"> <span class = "time" >{{ event. hour }}</span> <div class = "detail" ng-repeat = "item in event. data "> <span class =" linename "> {item. customerName }}</span> <div style = "float: right;"> <span class = "linenum" >{{ item. reserveNumber }}people </span> </div> </timeline-panel> </timeline-event> </timeline> </ion-content> </ ion-view>
// Controllerangular. module ('studyapp. controllers '). controller ('timelencectrl', function ($ scope, $ rootScope, $ location) {$ scope. title = 'timeline '; makeData (); function makeData () {$ scope. teamDataList = [{hour: "12:00", data: [{customerName: "China Travel (Jiangsu) International Travel Service Co., Ltd.", reserveNumber: "12", id: "aaaabbb12112" },{ customerName: "Jiangsu 2", reserveNumber: "122", id: "aaaabbb12112"}] },{ hour: "", data: [{customerName: "Jiangsu 2", reserveNumber: "112", id: "aaaabbb12112"}] },{ hour: "14:00", data: [{customerName: "Jiangsu 3", reserveNumber: "12", id: "aaaabbb12112"}] },{ hour: "13:00", data: [{customerName: "Jiangsu 2", reserveNumber: "112", id: "aaaabbb12112"}]}, {hour: "", data: [{customerName: "Jiangsu 3", reserveNumber: "12", id: "aaaabbb12112"}] ;}});
Thu
The above is all the content of this article. I hope it will be helpful for your learning and support for helping customers.