mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2025-11-07 23:16:52 +08:00
Fixed #119 - slide box events
This commit is contained in:
6
dist/js/ionic-angular.js
vendored
6
dist/js/ionic-angular.js
vendored
@ -22997,6 +22997,7 @@ angular.module('ionic.ui', [
|
||||
'ionic.ui.nav',
|
||||
'ionic.ui.header',
|
||||
'ionic.ui.sideMenu',
|
||||
'ionic.ui.slideBox',
|
||||
'ionic.ui.list',
|
||||
'ionic.ui.checkbox',
|
||||
'ionic.ui.toggle',
|
||||
@ -24426,7 +24427,10 @@ angular.module('ionic.ui.slideBox', [])
|
||||
$element.append(pager);
|
||||
|
||||
$scope.slideBox = new ionic.views.SlideBox({
|
||||
el: $element[0]
|
||||
el: $element[0],
|
||||
slideChanged: function(slideIndex) {
|
||||
$scope.$parent.$broadcast('slideBox.slideChanged', slideIndex);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
7
dist/js/ionic.js
vendored
7
dist/js/ionic.js
vendored
@ -3679,6 +3679,7 @@ window.ionic = {
|
||||
initialize: function(opts) {
|
||||
var _this = this;
|
||||
|
||||
this.slideChanged = opts.slideChanged || function() {};
|
||||
this.el = opts.el;
|
||||
this.pager = this.el.querySelector('.slide-box-pager');
|
||||
|
||||
@ -3787,9 +3788,15 @@ window.ionic = {
|
||||
content.classList.add('slide-box-animating');
|
||||
content.style.webkitTransform = 'translate3d(' + -offsetX + 'px, 0, 0)';
|
||||
|
||||
var lastSlide = this.slideIndex;
|
||||
|
||||
// Update the slide index
|
||||
this.slideIndex = Math.ceil(offsetX / slideWidth);
|
||||
|
||||
if(lastSlide !== this.slideIndex) {
|
||||
this.slideChanged && this.slideChanged(this.slideIndex);
|
||||
}
|
||||
|
||||
this._updatePager();
|
||||
},
|
||||
|
||||
|
||||
Reference in New Issue
Block a user