mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2025-11-07 15:07:13 +08:00
removed div.track from toggle
This commit is contained in:
18
dist/js/ionic.js
vendored
18
dist/js/ionic.js
vendored
@ -2875,20 +2875,8 @@ ionic.views.TabBar.prototype = {
|
||||
ionic.views.Toggle = function(opts) {
|
||||
this.el = opts.el;
|
||||
this.checkbox = opts.checkbox;
|
||||
this.track = opts.track;
|
||||
this.handle = opts.handle;
|
||||
this.openPercent = -1;
|
||||
|
||||
/*
|
||||
// remember that this element, and all its children are apart of a component
|
||||
// and assign the component instance to each element so the lookups
|
||||
// only has to go through this process just once
|
||||
this.el.isComponent = true;
|
||||
this.track.component = this;
|
||||
this.track.isComponent = true;
|
||||
this.handle.component = this;
|
||||
this.handle.isComponent = true;
|
||||
*/
|
||||
};
|
||||
|
||||
ionic.views.Toggle.prototype = {
|
||||
@ -2898,8 +2886,8 @@ ionic.views.TabBar.prototype = {
|
||||
},
|
||||
|
||||
drag: function(e) {
|
||||
var slidePageLeft = this.track.offsetLeft + (this.handle.offsetWidth / 2);
|
||||
var slidePageRight = this.track.offsetLeft + this.track.offsetWidth - (this.handle.offsetWidth / 2);
|
||||
var slidePageLeft = this.checkbox.offsetLeft + (this.handle.offsetWidth / 2);
|
||||
var slidePageRight = this.checkbox.offsetLeft + this.checkbox.offsetWidth - (this.handle.offsetWidth / 2);
|
||||
|
||||
if(e.pageX >= slidePageRight - 4) {
|
||||
this.val(true);
|
||||
@ -2920,7 +2908,7 @@ ionic.views.TabBar.prototype = {
|
||||
} else if(openPercent === 100) {
|
||||
this.val(true);
|
||||
} else {
|
||||
var openPixel = Math.round( (openPercent / 100) * this.track.offsetWidth - (this.handle.offsetWidth) );
|
||||
var openPixel = Math.round( (openPercent / 100) * this.checkbox.offsetWidth - (this.handle.offsetWidth) );
|
||||
openPixel = (openPixel < 1 ? 0 : openPixel);
|
||||
this.handle.style.webkitTransform = 'translate3d(' + openPixel + 'px,0,0)';
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user