Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- visitStation: function(city, isReturn) {
- this.currStation = this.nextStation;
- this.nextStation = parseInt($(city).attr("data-id"));
- var station = $(city).find(".city__name").text();
- if (typeof(isReturn) == "undefined") {
- isReturn = false;
- }
- //если станция, куда нужно доехать, в карусели городов левее, чем текущая станция
- if (this.nextStation < this.currStation) {
- //паровозик уезжает за правый край экрана и приезжает на нужную станцию из-за левой части экрана
- this.reset(function() {
- this.visitStation(city, true);
- //подсвечиваем семафор над станцией, куда приехал паровозик
- this.activateStation(city);
- }.bind(this));
- } else if (this.nextStation != this.currStation) {
- var distance = stations[station] - trainPos - trainWidth;
- $(train).velocity({
- translateX: distance + "px"
- });
- if (!isReturn) {
- this.activateStation(city);
- }
- }
- }
Add Comment
Please, Sign In to add comment