mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2025-08-20 20:33:32 +08:00
perf(toggle): css containment
This commit is contained in:
@ -60,6 +60,13 @@ $toggle-ios-item-right-padding: 6px ($item-ios-padding-right / 2) 5px ($i
|
||||
|
||||
.toggle-ios {
|
||||
position: relative;
|
||||
|
||||
width: $toggle-ios-width;
|
||||
height: $toggle-ios-height;
|
||||
|
||||
box-sizing: content-box;
|
||||
|
||||
contain: strict;
|
||||
}
|
||||
|
||||
|
||||
@ -70,8 +77,8 @@ $toggle-ios-item-right-padding: 6px ($item-ios-padding-right / 2) 5px ($i
|
||||
position: relative;
|
||||
display: block;
|
||||
|
||||
width: $toggle-ios-width;
|
||||
height: $toggle-ios-height;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
|
||||
border-radius: $toggle-ios-border-radius;
|
||||
|
||||
@ -117,6 +124,9 @@ $toggle-ios-item-right-padding: 6px ($item-ios-padding-right / 2) 5px ($i
|
||||
box-shadow: $toggle-ios-handle-box-shadow;
|
||||
|
||||
transition: transform $toggle-ios-transition-duration, width 120ms ease-in-out 80ms, left 110ms ease-in-out 80ms;
|
||||
|
||||
will-change: transform;
|
||||
contain: strict;
|
||||
}
|
||||
|
||||
|
||||
|
@ -67,6 +67,8 @@ $toggle-md-item-right-padding: 12px ($item-md-padding-right / 2) 12px
|
||||
height: $toggle-md-track-height;
|
||||
|
||||
box-sizing: content-box;
|
||||
|
||||
contain: strict;
|
||||
}
|
||||
|
||||
|
||||
@ -117,7 +119,7 @@ $toggle-md-item-right-padding: 12px ($item-md-padding-right / 2) 12px
|
||||
// Material Design Toggle Background Track: Checked
|
||||
// -----------------------------------------
|
||||
|
||||
.toggle-md .toggle-checked {
|
||||
.toggle-md.toggle-checked .toggle-icon {
|
||||
background-color: $toggle-md-track-background-color-on;
|
||||
}
|
||||
|
||||
|
@ -72,6 +72,13 @@ $toggle-wp-item-right-padding: 12px ($item-wp-padding-right / 2) 12px
|
||||
|
||||
.toggle-wp {
|
||||
position: relative;
|
||||
|
||||
width: $toggle-wp-track-width;
|
||||
height: $toggle-wp-track-height;
|
||||
|
||||
box-sizing: content-box;
|
||||
|
||||
contain: strict;
|
||||
}
|
||||
|
||||
|
||||
@ -82,14 +89,16 @@ $toggle-wp-item-right-padding: 12px ($item-wp-padding-right / 2) 12px
|
||||
position: relative;
|
||||
display: block;
|
||||
|
||||
width: $toggle-wp-track-width;
|
||||
height: $toggle-wp-track-height;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
|
||||
border: $toggle-wp-track-border-width solid $toggle-wp-track-border-color-off;
|
||||
border-radius: $toggle-wp-track-height;
|
||||
background-color: $toggle-wp-track-background-color-off;
|
||||
|
||||
pointer-events: none;
|
||||
|
||||
contain: strict;
|
||||
}
|
||||
|
||||
|
||||
@ -109,6 +118,8 @@ $toggle-wp-item-right-padding: 12px ($item-wp-padding-right / 2) 12px
|
||||
|
||||
transition-duration: $toggle-wp-transition-duration;
|
||||
transition-property: transform, background-color;
|
||||
|
||||
will-change: transform, background-color;
|
||||
}
|
||||
|
||||
|
||||
@ -126,7 +137,6 @@ $toggle-wp-item-right-padding: 12px ($item-wp-padding-right / 2) 12px
|
||||
|
||||
.toggle-wp.toggle-checked .toggle-inner {
|
||||
background-color: $toggle-wp-handle-background-color-on;
|
||||
// transform: translate3d(23px, 0, 0);
|
||||
transform: translate3d($toggle-wp-track-width - $toggle-wp-handle-width - ($toggle-wp-track-border-width * 2) - ($toggle-wp-handle-left * 2), 0, 0);
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user