Skip to content

Commit 85182c9

Browse files
Kevin MeyerWaleyChen
authored andcommitted
update gifs for tour
1 parent a8fb29f commit 85182c9

File tree

8 files changed

+38
-34
lines changed

8 files changed

+38
-34
lines changed

images/tour/f1.gif

-860 KB
Loading

images/tour/f2.gif

-3.59 MB
Loading

images/tour/f3.gif

-559 KB
Loading

images/tour/f4.gif

-446 KB
Loading

images/tour/f5.gif

-2.92 MB
Loading

src/home/index.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,8 +50,9 @@ var HomeView = View.extend({
5050
},
5151
render: function() {
5252
this.renderWithTemplate(this);
53-
if (app.isFeatureEnabled('First Run Tour')) {
53+
if (typeof localStorage.tourHasRun === 'undefined') {
5454
this.renderSubview(new TourView(), this.queryByHook('tour-container'));
55+
localStorage.tourHasRun = 'true';
5556
}
5657
},
5758
onInstanceFetched: function() {

src/tour/index.js

Lines changed: 31 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,22 @@
1+
var $ = require('jquery');
12
var View = require('ampersand-view');
23

34
var TourView = View.extend({
45
props: {
5-
tourCount: {
6-
type: 'number',
7-
default: 0
8-
},
9-
tourImages: {
10-
type: 'array',
11-
default: function() {
12-
return ['f1.gif', 'f2.gif', 'f3.gif', 'f4.gif', 'f5.gif'];
13-
}
14-
},
15-
tourImagesFolder: {
16-
type: 'string',
17-
default: './images/tour/'
6+
isAnimating: { type: 'boolean', default: true },
7+
tourCount: { type: 'number', default: 0 },
8+
tourImages: { type: 'array', default: function() {
9+
return [
10+
{ file: 'f1.gif', duration: 4000 },
11+
{ file: 'f2.gif', duration: 9000 },
12+
{ file: 'f3.gif', duration: 9000 },
13+
{ file: 'f4.gif', duration: 6000 },
14+
{ file: 'f5.gif', duration: 9000 }
15+
];
1816
}
17+
},
18+
tourImagesFolder: { type: 'string', default: './images/tour/' }
1919
},
20-
2120
template: require('./index.jade'),
2221
events: {
2322
'click #features ul': 'showFeature',
@@ -27,39 +26,44 @@ var TourView = View.extend({
2726
render: function() {
2827
var that = this;
2928
this.renderWithTemplate(this);
30-
3129
this.$featuresUL = this.query('#features ul');
3230
this.$featuresLI = this.queryAll('#features li');
3331
this.$animationGIF = this.query('#animation-gif');
3432
this.$tourRemove = this.query('#tour-remove');
35-
36-
this.playAuto = setInterval(function() {
37-
that.$featuresLI[that.tourCount].className = '';
38-
33+
function showAnimation() {
34+
var duration = that.tourImages[that.tourCount].duration;
35+
// deselect old
36+
$('#features li.selected').removeClass('selected');
37+
// select new
38+
that.$featuresLI[that.tourCount].className = 'selected';
39+
that.$animationGIF.src = that.tourImagesFolder + that.tourImages[that.tourCount].file;
3940
if (that.tourCount === 4) {
4041
that.tourCount = 0;
4142
} else {
4243
that.tourCount++;
4344
}
44-
that.$featuresLI[that.tourCount].className = 'selected';
45-
that.$animationGIF.src = that.tourImagesFolder + that.tourImages[that.tourCount];
46-
}, 1000 * 7);
45+
if (that.isAnimating) {
46+
setTimeout(showAnimation, duration);
47+
}
48+
}
49+
showAnimation();
4750
},
48-
4951
showFeature: function(ev) {
52+
this.isAnimating = false;
5053
var nCLick = ev.target.getAttribute('data-n');
51-
if (!nCLick) {
54+
if (nCLick === null) {
5255
return false;
5356
}
5457
var nFeature = parseInt(nCLick, 10);
55-
this.$featuresLI[this.tourCount].className = '';
58+
// deselect old
59+
$('#features li.selected').removeClass('selected');
60+
// select new
5661
ev.target.className = 'selected';
5762
this.$animationGIF.src = this.tourImagesFolder + ev.target.id + '.gif';
5863
this.tourCount = nFeature;
59-
clearInterval(this.playAuto);
6064
},
6165
tourRemove: function() {
62-
clearInterval(this.playAuto);
66+
this.isAnimating = false;
6367
this.remove();
6468
}
6569
});

src/tour/index.less

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -21,27 +21,26 @@
2121
left: 50%;
2222
-webkit-transform: translate(-50%, -50%);
2323

24-
width: 80%;
25-
max-width: 925px;
24+
width: 90%;
25+
max-width: 1200px;
2626
position: absolute;
2727
background-color: white;
28-
border-radius: 9px;
2928

3029
#animation, #features {
3130
float: left;
3231
}
3332
#animation {
34-
width: 66%;
33+
width: 70%;
3534

3635
img {
37-
width: 80%;
36+
width: 83%;
3837
margin: 60px auto;
3938
display: block;
4039
border: 1px lightgrey solid;
4140
}
4241
}
4342
#features {
44-
width: 33%;
43+
width: 30%;
4544

4645
h2 {
4746
margin: 60px 0 0;

0 commit comments

Comments
 (0)