Guest User

Untitled

a guest
Nov 23rd, 2017
78
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.08 KB | None | 0 0
  1. visitStation: function(city, isReturn) {
  2. this.currStation = this.nextStation;
  3. this.nextStation = parseInt($(city).attr("data-id"));
  4. var station = $(city).find(".city__name").text();
  5. if (typeof(isReturn) == "undefined") {
  6. isReturn = false;
  7. }
  8. //если станция, куда нужно доехать, в карусели городов левее, чем текущая станция
  9. if (this.nextStation < this.currStation) {
  10. //паровозик уезжает за правый край экрана и приезжает на нужную станцию из-за левой части экрана
  11. this.reset(function() {
  12. this.visitStation(city, true);
  13. //подсвечиваем семафор над станцией, куда приехал паровозик
  14. this.activateStation(city);
  15. }.bind(this));
  16. } else if (this.nextStation != this.currStation) {
  17. var distance = stations[station] - trainPos - trainWidth;
  18. $(train).velocity({
  19. translateX: distance + "px"
  20. });
  21. if (!isReturn) {
  22. this.activateStation(city);
  23. }
  24. }
  25. }
Add Comment
Please, Sign In to add comment