mirror of
https://github.com/Hopiu/angular.js.git
synced 2026-05-09 07:14:44 +00:00
chore(docs): refactor/improve new CSS transition code in examples
This commit is contained in:
parent
b1d4d580e5
commit
aba0fe6830
7 changed files with 73 additions and 120 deletions
|
|
@ -160,26 +160,17 @@ function classDirective(name, selector) {
|
||||||
<input type="button" value="set" ng-click="myVar='my-class'">
|
<input type="button" value="set" ng-click="myVar='my-class'">
|
||||||
<input type="button" value="clear" ng-click="myVar=''">
|
<input type="button" value="clear" ng-click="myVar=''">
|
||||||
<br>
|
<br>
|
||||||
<span ng-class="myVar">Sample Text</span>
|
<span class="base-class" ng-class="myVar">Sample Text</span>
|
||||||
</file>
|
</file>
|
||||||
<file name="style.css">
|
<file name="style.css">
|
||||||
.my-class-add, .my-class-remove {
|
.base-class {
|
||||||
-webkit-transition:all cubic-bezier(0.250, 0.460, 0.450, 0.940) 0.5s;
|
|
||||||
-moz-transition:all cubic-bezier(0.250, 0.460, 0.450, 0.940) 0.5s;
|
|
||||||
-o-transition:all cubic-bezier(0.250, 0.460, 0.450, 0.940) 0.5s;
|
|
||||||
transition:all cubic-bezier(0.250, 0.460, 0.450, 0.940) 0.5s;
|
transition:all cubic-bezier(0.250, 0.460, 0.450, 0.940) 0.5s;
|
||||||
}
|
}
|
||||||
|
|
||||||
.my-class,
|
.base-class.my-class {
|
||||||
.my-class-add.my-class-add-active {
|
|
||||||
color: red;
|
color: red;
|
||||||
font-size:3em;
|
font-size:3em;
|
||||||
}
|
}
|
||||||
|
|
||||||
.my-class-remove.my-class-remove-active {
|
|
||||||
font-size:1.0em;
|
|
||||||
color:black;
|
|
||||||
}
|
|
||||||
</file>
|
</file>
|
||||||
<file name="scenario.js">
|
<file name="scenario.js">
|
||||||
it('should check ng-class', function() {
|
it('should check ng-class', function() {
|
||||||
|
|
|
||||||
|
|
@ -59,10 +59,11 @@
|
||||||
padding:10px;
|
padding:10px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
The transition styles can also be placed on the CSS base class above
|
||||||
|
*/
|
||||||
.animate-if.ng-enter, .animate-if.ng-leave {
|
.animate-if.ng-enter, .animate-if.ng-leave {
|
||||||
-webkit-transition:all cubic-bezier(0.250, 0.460, 0.450, 0.940) 0.5s;
|
-webkit-transition:all cubic-bezier(0.250, 0.460, 0.450, 0.940) 0.5s;
|
||||||
-moz-transition:all cubic-bezier(0.250, 0.460, 0.450, 0.940) 0.5s;
|
|
||||||
-o-transition:all cubic-bezier(0.250, 0.460, 0.450, 0.940) 0.5s;
|
|
||||||
transition:all cubic-bezier(0.250, 0.460, 0.450, 0.940) 0.5s;
|
transition:all cubic-bezier(0.250, 0.460, 0.450, 0.940) 0.5s;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -71,8 +72,8 @@
|
||||||
opacity:0;
|
opacity:0;
|
||||||
}
|
}
|
||||||
|
|
||||||
.animate-if.ng-enter.ng-enter-active,
|
.animate-if.ng-leave,
|
||||||
.animate-if.ng-leave {
|
.animate-if.ng-enter.ng-enter-active {
|
||||||
opacity:1;
|
opacity:1;
|
||||||
}
|
}
|
||||||
</file>
|
</file>
|
||||||
|
|
|
||||||
|
|
@ -51,8 +51,8 @@
|
||||||
</select>
|
</select>
|
||||||
url of the template: <tt>{{template.url}}</tt>
|
url of the template: <tt>{{template.url}}</tt>
|
||||||
<hr/>
|
<hr/>
|
||||||
<div class="example-animate-container">
|
<div class="slide-animate-container">
|
||||||
<div class="include-example" ng-include="template.url"></div>
|
<div class="slide-animate" ng-include="template.url"></div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</file>
|
</file>
|
||||||
|
|
@ -71,7 +71,7 @@
|
||||||
Content of template2.html
|
Content of template2.html
|
||||||
</file>
|
</file>
|
||||||
<file name="animations.css">
|
<file name="animations.css">
|
||||||
.example-animate-container {
|
.slide-animate-container {
|
||||||
position:relative;
|
position:relative;
|
||||||
background:white;
|
background:white;
|
||||||
border:1px solid black;
|
border:1px solid black;
|
||||||
|
|
@ -79,14 +79,12 @@
|
||||||
overflow:hidden;
|
overflow:hidden;
|
||||||
}
|
}
|
||||||
|
|
||||||
.example-animate-container > div {
|
.slide-animate {
|
||||||
padding:10px;
|
padding:10px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.include-example.ng-enter, .include-example.ng-leave {
|
.slide-animate.ng-enter, .slide-animate.ng-leave {
|
||||||
-webkit-transition:all cubic-bezier(0.250, 0.460, 0.450, 0.940) 0.5s;
|
-webkit-transition:all cubic-bezier(0.250, 0.460, 0.450, 0.940) 0.5s;
|
||||||
-moz-transition:all cubic-bezier(0.250, 0.460, 0.450, 0.940) 0.5s;
|
|
||||||
-o-transition:all cubic-bezier(0.250, 0.460, 0.450, 0.940) 0.5s;
|
|
||||||
transition:all cubic-bezier(0.250, 0.460, 0.450, 0.940) 0.5s;
|
transition:all cubic-bezier(0.250, 0.460, 0.450, 0.940) 0.5s;
|
||||||
|
|
||||||
position:absolute;
|
position:absolute;
|
||||||
|
|
@ -98,17 +96,17 @@
|
||||||
padding:10px;
|
padding:10px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.include-example.ng-enter {
|
.slide-animate.ng-enter {
|
||||||
top:-50px;
|
top:-50px;
|
||||||
}
|
}
|
||||||
.include-example.ng-enter.ng-enter-active {
|
.slide-animate.ng-enter.ng-enter-active {
|
||||||
top:0;
|
top:0;
|
||||||
}
|
}
|
||||||
|
|
||||||
.include-example.ng-leave {
|
.slide-animate.ng-leave {
|
||||||
top:0;
|
top:0;
|
||||||
}
|
}
|
||||||
.include-example.ng-leave.ng-leave-active {
|
.slide-animate.ng-leave.ng-leave-active {
|
||||||
top:50px;
|
top:50px;
|
||||||
}
|
}
|
||||||
</file>
|
</file>
|
||||||
|
|
|
||||||
|
|
@ -140,49 +140,35 @@
|
||||||
border:1px solid black;
|
border:1px solid black;
|
||||||
list-style:none;
|
list-style:none;
|
||||||
margin:0;
|
margin:0;
|
||||||
padding:0;
|
padding:0 10px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.example-animate-container > li {
|
.animate-repeat {
|
||||||
padding:10px;
|
line-height:40px;
|
||||||
list-style:none;
|
list-style:none;
|
||||||
|
box-sizing:border-box;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.animate-repeat.ng-move,
|
||||||
.animate-repeat.ng-enter,
|
.animate-repeat.ng-enter,
|
||||||
.animate-repeat.ng-leave,
|
.animate-repeat.ng-leave {
|
||||||
.animate-repeat.ng-move {
|
|
||||||
-webkit-transition:all linear 0.5s;
|
-webkit-transition:all linear 0.5s;
|
||||||
-moz-transition:all linear 0.5s;
|
|
||||||
-o-transition:all linear 0.5s;
|
|
||||||
transition:all linear 0.5s;
|
transition:all linear 0.5s;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.animate-repeat.ng-leave.ng-leave-active,
|
||||||
|
.animate-repeat.ng-move,
|
||||||
.animate-repeat.ng-enter {
|
.animate-repeat.ng-enter {
|
||||||
line-height:0;
|
|
||||||
opacity:0;
|
opacity:0;
|
||||||
padding-top:0;
|
max-height:0;
|
||||||
padding-bottom:0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.animate-repeat.ng-leave,
|
||||||
|
.animate-repeat.ng-move.ng-move-active,
|
||||||
.animate-repeat.ng-enter.ng-enter-active {
|
.animate-repeat.ng-enter.ng-enter-active {
|
||||||
line-height:20px;
|
|
||||||
opacity:1;
|
opacity:1;
|
||||||
padding:10px;
|
max-height:40px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.animate-repeat.ng-leave {
|
|
||||||
opacity:1;
|
|
||||||
line-height:20px;
|
|
||||||
padding:10px;
|
|
||||||
}
|
|
||||||
.animate-repeat.ng-leave.ng-leave-active {
|
|
||||||
opacity:0;
|
|
||||||
line-height:0;
|
|
||||||
padding-top:0;
|
|
||||||
padding-bottom:0;
|
|
||||||
}
|
|
||||||
|
|
||||||
.animate-repeat.ng-move { }
|
|
||||||
.animate-repeat.ng-move.ng-move-active { }
|
|
||||||
</file>
|
</file>
|
||||||
<file name="scenario.js">
|
<file name="scenario.js">
|
||||||
it('should render initial data set', function() {
|
it('should render initial data set', function() {
|
||||||
|
|
|
||||||
|
|
@ -100,24 +100,9 @@
|
||||||
</div>
|
</div>
|
||||||
</file>
|
</file>
|
||||||
<file name="animations.css">
|
<file name="animations.css">
|
||||||
.animate-show.ng-hide-add,
|
.animate-show {
|
||||||
.animate-show.ng-hide-remove {
|
|
||||||
-webkit-transition:all linear 0.5s;
|
-webkit-transition:all linear 0.5s;
|
||||||
-moz-transition:all linear 0.5s;
|
|
||||||
-o-transition:all linear 0.5s;
|
|
||||||
transition:all linear 0.5s;
|
transition:all linear 0.5s;
|
||||||
display:block!important;
|
|
||||||
}
|
|
||||||
|
|
||||||
.animate-show.ng-hide-add.ng-hide-add-active,
|
|
||||||
.animate-show.ng-hide-remove {
|
|
||||||
line-height:0;
|
|
||||||
opacity:0;
|
|
||||||
padding:0 10px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.animate-show.ng-hide-add,
|
|
||||||
.animate-show.ng-hide-remove.ng-hide-remove-active {
|
|
||||||
line-height:20px;
|
line-height:20px;
|
||||||
opacity:1;
|
opacity:1;
|
||||||
padding:10px;
|
padding:10px;
|
||||||
|
|
@ -125,6 +110,17 @@
|
||||||
background:white;
|
background:white;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.animate-show.ng-hide-add,
|
||||||
|
.animate-show.ng-hide-remove {
|
||||||
|
display:block!important;
|
||||||
|
}
|
||||||
|
|
||||||
|
.animate-show.ng-hide {
|
||||||
|
line-height:0;
|
||||||
|
opacity:0;
|
||||||
|
padding:0 10px;
|
||||||
|
}
|
||||||
|
|
||||||
.check-element {
|
.check-element {
|
||||||
padding:10px;
|
padding:10px;
|
||||||
border:1px solid black;
|
border:1px solid black;
|
||||||
|
|
@ -253,24 +249,9 @@ var ngShowDirective = ['$animate', function($animate) {
|
||||||
</div>
|
</div>
|
||||||
</file>
|
</file>
|
||||||
<file name="animations.css">
|
<file name="animations.css">
|
||||||
.animate-hide.ng-hide-add,
|
.animate-hide {
|
||||||
.animate-hide.ng-hide-remove {
|
|
||||||
-webkit-transition:all linear 0.5s;
|
-webkit-transition:all linear 0.5s;
|
||||||
-moz-transition:all linear 0.5s;
|
|
||||||
-o-transition:all linear 0.5s;
|
|
||||||
transition:all linear 0.5s;
|
transition:all linear 0.5s;
|
||||||
display:block!important;
|
|
||||||
}
|
|
||||||
|
|
||||||
.animate-hide.ng-hide-add.ng-hide-add-active,
|
|
||||||
.animate-hide.ng-hide-remove {
|
|
||||||
line-height:0;
|
|
||||||
opacity:0;
|
|
||||||
padding:0 10px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.animate-hide.ng-hide-add,
|
|
||||||
.animate-hide.ng-hide-remove.ng-hide-remove-active {
|
|
||||||
line-height:20px;
|
line-height:20px;
|
||||||
opacity:1;
|
opacity:1;
|
||||||
padding:10px;
|
padding:10px;
|
||||||
|
|
@ -278,6 +259,17 @@ var ngShowDirective = ['$animate', function($animate) {
|
||||||
background:white;
|
background:white;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.animate-hide.ng-hide-add,
|
||||||
|
.animate-hide.ng-hide-remove {
|
||||||
|
display:block!important;
|
||||||
|
}
|
||||||
|
|
||||||
|
.animate-hide.ng-hide {
|
||||||
|
line-height:0;
|
||||||
|
opacity:0;
|
||||||
|
padding:0 10px;
|
||||||
|
}
|
||||||
|
|
||||||
.check-element {
|
.check-element {
|
||||||
padding:10px;
|
padding:10px;
|
||||||
border:1px solid black;
|
border:1px solid black;
|
||||||
|
|
|
||||||
|
|
@ -54,9 +54,9 @@
|
||||||
<hr/>
|
<hr/>
|
||||||
<div class="animate-switch-container"
|
<div class="animate-switch-container"
|
||||||
ng-switch on="selection">
|
ng-switch on="selection">
|
||||||
<div ng-switch-when="settings">Settings Div</div>
|
<div class="animate-switch" ng-switch-when="settings">Settings Div</div>
|
||||||
<div ng-switch-when="home">Home Span</div>
|
<div class="animate-switch" ng-switch-when="home">Home Span</div>
|
||||||
<div ng-switch-default>default</div>
|
<div class="animate-switch" ng-switch-default>default</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</file>
|
</file>
|
||||||
|
|
@ -75,15 +75,12 @@
|
||||||
overflow:hidden;
|
overflow:hidden;
|
||||||
}
|
}
|
||||||
|
|
||||||
.animate-switch-container > div {
|
.animate-switch {
|
||||||
padding:10px;
|
padding:10px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.animate-switch-container > .ng-enter,
|
.animate-switch.ng-animate {
|
||||||
.animate-switch-container > .ng-leave {
|
|
||||||
-webkit-transition:all cubic-bezier(0.250, 0.460, 0.450, 0.940) 0.5s;
|
-webkit-transition:all cubic-bezier(0.250, 0.460, 0.450, 0.940) 0.5s;
|
||||||
-moz-transition:all cubic-bezier(0.250, 0.460, 0.450, 0.940) 0.5s;
|
|
||||||
-o-transition:all cubic-bezier(0.250, 0.460, 0.450, 0.940) 0.5s;
|
|
||||||
transition:all cubic-bezier(0.250, 0.460, 0.450, 0.940) 0.5s;
|
transition:all cubic-bezier(0.250, 0.460, 0.450, 0.940) 0.5s;
|
||||||
|
|
||||||
position:absolute;
|
position:absolute;
|
||||||
|
|
@ -93,19 +90,14 @@
|
||||||
bottom:0;
|
bottom:0;
|
||||||
}
|
}
|
||||||
|
|
||||||
.animate-switch-container > .ng-enter {
|
.animate-switch.ng-leave.ng-leave-active,
|
||||||
|
.animate-switch.ng-enter {
|
||||||
top:-50px;
|
top:-50px;
|
||||||
}
|
}
|
||||||
.animate-switch-container > .ng-enter.ng-enter-active {
|
.animate-switch.ng-leave,
|
||||||
|
.animate-switch.ng-enter.ng-enter-active {
|
||||||
top:0;
|
top:0;
|
||||||
}
|
}
|
||||||
|
|
||||||
.animate-switch-container > .ng-leave {
|
|
||||||
top:0;
|
|
||||||
}
|
|
||||||
.animate-switch-container > .ng-leave.ng-leave-active {
|
|
||||||
top:50px;
|
|
||||||
}
|
|
||||||
</file>
|
</file>
|
||||||
<file name="scenario.js">
|
<file name="scenario.js">
|
||||||
it('should start in settings', function() {
|
it('should start in settings', function() {
|
||||||
|
|
|
||||||
|
|
@ -35,8 +35,8 @@ ngRouteModule.directive('ngView', ngViewFactory);
|
||||||
<a href="Book/Gatsby/ch/4?key=value">Gatsby: Ch4</a> |
|
<a href="Book/Gatsby/ch/4?key=value">Gatsby: Ch4</a> |
|
||||||
<a href="Book/Scarlet">Scarlet Letter</a><br/>
|
<a href="Book/Scarlet">Scarlet Letter</a><br/>
|
||||||
|
|
||||||
<div class="example-animate-container">
|
<div class="view-animate-container">
|
||||||
<div ng-view class="view-example"></div>
|
<div ng-view class="view-animate"></div>
|
||||||
</div>
|
</div>
|
||||||
<hr />
|
<hr />
|
||||||
|
|
||||||
|
|
@ -64,7 +64,9 @@ ngRouteModule.directive('ngView', ngViewFactory);
|
||||||
</file>
|
</file>
|
||||||
|
|
||||||
<file name="animations.css">
|
<file name="animations.css">
|
||||||
.example-animate-container {
|
.view-animate-container {
|
||||||
|
position:relative;
|
||||||
|
height:100px!important;
|
||||||
position:relative;
|
position:relative;
|
||||||
background:white;
|
background:white;
|
||||||
border:1px solid black;
|
border:1px solid black;
|
||||||
|
|
@ -72,14 +74,12 @@ ngRouteModule.directive('ngView', ngViewFactory);
|
||||||
overflow:hidden;
|
overflow:hidden;
|
||||||
}
|
}
|
||||||
|
|
||||||
.example-animate-container > div {
|
.view-animate {
|
||||||
padding:10px;
|
padding:10px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.view-example.ng-enter, .view-example.ng-leave {
|
.view-animate.ng-enter, .view-animate.ng-leave {
|
||||||
-webkit-transition:all cubic-bezier(0.250, 0.460, 0.450, 0.940) 1.5s;
|
-webkit-transition:all cubic-bezier(0.250, 0.460, 0.450, 0.940) 1.5s;
|
||||||
-moz-transition:all cubic-bezier(0.250, 0.460, 0.450, 0.940) 1.5s;
|
|
||||||
-o-transition:all cubic-bezier(0.250, 0.460, 0.450, 0.940) 1.5s;
|
|
||||||
transition:all cubic-bezier(0.250, 0.460, 0.450, 0.940) 1.5s;
|
transition:all cubic-bezier(0.250, 0.460, 0.450, 0.940) 1.5s;
|
||||||
|
|
||||||
display:block;
|
display:block;
|
||||||
|
|
@ -94,20 +94,13 @@ ngRouteModule.directive('ngView', ngViewFactory);
|
||||||
padding:10px;
|
padding:10px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.example-animate-container {
|
.view-animate.ng-enter {
|
||||||
position:relative;
|
|
||||||
height:100px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.view-example.ng-enter {
|
|
||||||
left:100%;
|
left:100%;
|
||||||
}
|
}
|
||||||
.view-example.ng-enter.ng-enter-active {
|
.view-animate.ng-enter.ng-enter-active {
|
||||||
left:0;
|
left:0;
|
||||||
}
|
}
|
||||||
|
.view-animate.ng-leave.ng-leave-active {
|
||||||
.view-example.ng-leave { }
|
|
||||||
.view-example.ng-leave.ng-leave-active {
|
|
||||||
left:-100%;
|
left:-100%;
|
||||||
}
|
}
|
||||||
</file>
|
</file>
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue