Created
August 28, 2015 13:37
-
-
Save vitch/bad10a848dda43c289ac to your computer and use it in GitHub Desktop.
New Twiddle
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Ember from 'ember'; | |
export default Ember.Controller.extend({ | |
sections: [1,2,3,4,5], | |
currentSection: 0, | |
isLastSection: Ember.computed('currentSection', function() { | |
return this.get('currentSection') === this.get('sections.length') - 1; | |
}), | |
sectionClassName: Ember.computed('currentSection', function() { | |
return 'section-' + this.get('currentSection'); | |
}), | |
actions: { | |
gotoNext() { | |
this.incrementProperty('currentSection'); | |
}, | |
gotoSection(section) { | |
var sectionIndex = this.get('sections').indexOf(section); | |
this.set('currentSection', sectionIndex); | |
} | |
} | |
}); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
body { | |
margin: 12px 16px; | |
font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif; | |
font-size: 12pt; | |
} | |
.sections-nav { | |
list-style: none; | |
margin: 0; | |
padding: 0; | |
position: relative; | |
} | |
.sections-nav li { | |
border-radius: 50%; | |
background: #ccc; | |
cursor: pointer; | |
display: inline-block; | |
height: 10px; | |
margin: 0 5px; | |
width: 10px; | |
} | |
.sections-nav li.active-marker { | |
background: #999; | |
position: absolute; | |
left: 0; | |
pointer-events: none; | |
top: 5px; | |
transition: left .3s ease-in-out; | |
} | |
.section-1 li.active-marker { | |
left: 24px; | |
} | |
.section-2 li.active-marker { | |
left: 49px; | |
} | |
.section-3 li.active-marker { | |
left: 74px; | |
} | |
.section-4 li.active-marker { | |
left: 99px; | |
} | |
/* etc */ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"version": "0.4.9", | |
"dependencies": { | |
"jquery": "https://cdnjs.cloudflare.com/ajax/libs/jquery/1.11.3/jquery.js", | |
"ember": "https://cdnjs.cloudflare.com/ajax/libs/ember.js/1.13.9/ember.js", | |
"ember-data": "https://cdnjs.cloudflare.com/ajax/libs/ember-data.js/1.13.11/ember-data.js", | |
"ember-template-compiler": "https://cdnjs.cloudflare.com/ajax/libs/ember.js/1.13.9/ember-template-compiler.js" | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment