Portal
Time training is achieved by calculating the difference between two times and the length of the entire timeline.
Locatehandler = function () {var refertime = (that [that. length]-That [0])/86400000, I = 0, Len = That. handler. length, temp = 0; For (; I <Len;) {temp = (that [I]-That [0])/(refertime * 86400000) * That. parent. offsetwidth; that. FX (that. handler [I], 'left', (I = len-1 | I = 0 )? Temp-20: temp), 50); I ++ ;}
In order to reduce the number of computations, you can store the graphic panel, time point, and time location information during operations, so that you can compute and store the information during operations, the second operation reads the cache location information. Set the position directly with CSS to reduce the calculation workload
Cache = [[], [], []
There is only one set of information during initialization.
After touching two time points, the location data has been cached.
If (! Indicator. cache [1] [Index]) {If (rect. left-Div. offsetwidth/2) <limit. left) {indicator. cache [1] [Index] = 'visibility: visible; left: 0px; ';} else if (rect. left + Div. offsetwidth/2)> limit. right) {indicator. cache [1] [Index] = 'visibility: visible; left: '+ (limit. right-Div. offsetwidth-limit. left) + 'px; ';} else {indicator. cache [1] [Index] = 'visibility: visible; left: '+ (rect. left-Div. offsetwidth/2-limit. left) + 'px ;';}}
The position of the graphic panel is also obtained through intelligent computing. If the left side is exceeded, it is left aligned. In other cases, the time point is referenced in the center, and the right side is exceeded.
Some of the animations use tweenAlgorithmYou can modify it by yourself.