-
Notifications
You must be signed in to change notification settings - Fork 39
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ItemsComponentModel #179
ItemsComponentModel #179
Changes from 1 commit
2ef1a03
7233489
6e2e9fc
34c5aff
99c9c5f
0796892
c472ee1
a29859a
80c870b
7b9c9fb
d56ea09
11078e7
4cbe8ca
b2c479b
29ec474
9b89d5a
3cb171c
cc5b804
afdac59
60f9ea6
7b69b76
e4806b0
585b5ea
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -29,7 +29,10 @@ define([ | |
this.checkIfResetOnRevisit(); | ||
this._isInitial = true; | ||
this.calculateWidths(); | ||
_.bindAll(this, 'onTransitionEnd'); | ||
}, | ||
|
||
clamp: function(number, min, max) { | ||
return Math.max(min, Math.min(number, max)); | ||
}, | ||
|
||
onItemsActiveChange: function(item, _isActive) { | ||
|
@@ -177,15 +180,11 @@ define([ | |
if (Adapt.config.get('_disableAnimation')) { | ||
this.onTransitionEnd(); | ||
} else { | ||
$sliderElm.on('transitionend', this.onTransitionEnd); | ||
$sliderElm.one('transitionend', this.onTransitionEnd.bind(this)); | ||
} | ||
}, | ||
|
||
onTransitionEnd: function(event) { | ||
if (event) { | ||
$(event.currentTarget).off('transitionend', this.onTransitionEnd); | ||
} | ||
|
||
var index = this.model.getActiveItem().get('_index'); | ||
if (this.model.get('_isDesktop')) { | ||
if (!this._isInitial) { | ||
|
@@ -265,13 +264,11 @@ define([ | |
var numberOfItems = this.model.get('_children').length; | ||
|
||
if ($(event.currentTarget).hasClass('narrative-control-right')) { | ||
stage++; | ||
this.model.setActiveItem(stage); | ||
this.model.setActiveItem(stage+=1); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. could you change to |
||
} else if ($(event.currentTarget).hasClass('narrative-control-left')) { | ||
stage--; | ||
this.model.setActiveItem(stage); | ||
this.model.setActiveItem(stage-=1); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. could you change to |
||
} | ||
stage = (stage + numberOfItems) % numberOfItems; | ||
stage = this.clamp(stage, 0, numberOfItems); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I really think you can delete this line as |
||
}, | ||
|
||
onProgressClicked: function(event) { | ||
|
@@ -301,7 +298,7 @@ define([ | |
|
||
setupEventListeners: function() { | ||
if (this.model.get('_setCompletionOn') === 'inview') { | ||
this.$('.component-widget').on('inview', _.bind(this.inview, this)); | ||
this.$('.component-widget').on('inview', this.inview.bind(this)); | ||
} | ||
}, | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this function isn't needed