-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
af7a1ab
commit 4756aa2
Showing
7 changed files
with
166 additions
and
125 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,117 +1,150 @@ | ||
.view-container { | ||
position: relative; | ||
position: relative; | ||
} | ||
|
||
.view-frame.ng-enter, .view-frame.ng-leave { | ||
background: white; | ||
position: absolute; | ||
top: 0; | ||
left: 0; | ||
right: 0; | ||
.view-frame.ng-enter, | ||
.view-frame.ng-leave { | ||
background: white; | ||
position: absolute; | ||
top: 0; | ||
left: 0; | ||
right: 0; | ||
} | ||
|
||
.view-frame.ng-enter { | ||
-webkit-animation: 0.5s fade-in; | ||
-moz-animation: 0.5s fade-in; | ||
-o-animation: 0.5s fade-in; | ||
animation: 0.5s fade-in; | ||
z-index: 100; | ||
-webkit-animation: 0.5s fade-in; | ||
-moz-animation: 0.5s fade-in; | ||
-o-animation: 0.5s fade-in; | ||
animation: 0.5s fade-in; | ||
z-index: 100; | ||
} | ||
|
||
.view-frame.ng-leave { | ||
-webkit-animation: 0.5s fade-out; | ||
-moz-animation: 0.5s fade-out; | ||
-o-animation: 0.5s fade-out; | ||
animation: 0.5s fade-out; | ||
z-index:99; | ||
-webkit-animation: 0.5s fade-out; | ||
-moz-animation: 0.5s fade-out; | ||
-o-animation: 0.5s fade-out; | ||
animation: 0.5s fade-out; | ||
z-index: 99; | ||
} | ||
|
||
@keyframes fade-in { | ||
from { opacity: 0; } | ||
to { opacity: 1; } | ||
from { | ||
opacity: 0; | ||
} | ||
to { | ||
opacity: 1; | ||
} | ||
} | ||
@-moz-keyframes fade-in { | ||
from { opacity: 0; } | ||
to { opacity: 1; } | ||
from { | ||
opacity: 0; | ||
} | ||
to { | ||
opacity: 1; | ||
} | ||
} | ||
@-webkit-keyframes fade-in { | ||
from { opacity: 0; } | ||
to { opacity: 1; } | ||
from { | ||
opacity: 0; | ||
} | ||
to { | ||
opacity: 1; | ||
} | ||
} | ||
|
||
@keyframes fade-out { | ||
from { opacity: 1; } | ||
to { opacity: 0; } | ||
from { | ||
opacity: 1; | ||
} | ||
to { | ||
opacity: 0; | ||
} | ||
} | ||
@-moz-keyframes fade-out { | ||
from { opacity: 1; } | ||
to { opacity: 0; } | ||
from { | ||
opacity: 1; | ||
} | ||
to { | ||
opacity: 0; | ||
} | ||
} | ||
@-webkit-keyframes fade-out { | ||
from { opacity: 1; } | ||
to { opacity: 0; } | ||
from { | ||
opacity: 1; | ||
} | ||
to { | ||
opacity: 0; | ||
} | ||
} | ||
|
||
/* don't forget about the vendor-prefixes! */ | ||
|
||
|
||
/* | ||
We're using CSS transitions for when | ||
the enter and move events are triggered | ||
for the element that has the .repeated-item | ||
class | ||
*/ | ||
.repeated-item.ng-enter, .repeated-item.ng-move { | ||
-webkit-transition:0.5s linear all; | ||
-moz-transition:0.5s linear all; | ||
-o-transition:0.5s linear all; | ||
transition:0.5s linear all; | ||
opacity:0; | ||
} | ||
|
||
.repeated-item.ng-enter, | ||
.repeated-item.ng-move { | ||
-webkit-transition: 0.5s linear all; | ||
-moz-transition: 0.5s linear all; | ||
-o-transition: 0.5s linear all; | ||
transition: 0.5s linear all; | ||
opacity: 0; | ||
} | ||
/* | ||
The ng-enter-active and ng-move-active | ||
are where the transition destination properties | ||
are set so that the animation knows what to | ||
animate. | ||
*/ | ||
|
||
.repeated-item.ng-enter.ng-enter-active, | ||
.repeated-item.ng-move.ng-move-active { | ||
opacity:1; | ||
opacity: 1; | ||
} | ||
|
||
/* | ||
We're using CSS keyframe animations for when | ||
the leave event is triggered for the element | ||
that has the .repeated-item class | ||
*/ | ||
|
||
.repeated-item.ng-leave { | ||
-webkit-animation:0.5s my_animation; | ||
-moz-animation:0.5s my_animation; | ||
-o-animation:0.5s my_animation; | ||
animation:0.5s my_animation; | ||
-webkit-animation: 0.5s my_animation; | ||
-moz-animation: 0.5s my_animation; | ||
-o-animation: 0.5s my_animation; | ||
animation: 0.5s my_animation; | ||
} | ||
|
||
@keyframes my_animation { | ||
from { opacity:1; } | ||
to { opacity:0; } | ||
from { | ||
opacity: 1; | ||
} | ||
to { | ||
opacity: 0; | ||
} | ||
} | ||
|
||
/* | ||
Unfortunately each browser vendor requires | ||
its own definition of keyframe animation code... | ||
*/ | ||
|
||
@-webkit-keyframes my_animation { | ||
from { opacity:1; } | ||
to { opacity:0; } | ||
from { | ||
opacity: 1; | ||
} | ||
to { | ||
opacity: 0; | ||
} | ||
} | ||
|
||
@-moz-keyframes my_animation { | ||
from { opacity:1; } | ||
to { opacity:0; } | ||
from { | ||
opacity: 1; | ||
} | ||
to { | ||
opacity: 0; | ||
} | ||
} | ||
|
||
@-o-keyframes my_animation { | ||
from { opacity:1; } | ||
to { opacity:0; } | ||
from { | ||
opacity: 1; | ||
} | ||
to { | ||
opacity: 0; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,32 +1,64 @@ | ||
angular.module('myApp') | ||
.directive("mvLoadOnScroll", ['$window', '$timeout', function ($window, $timeout) { | ||
"use strict"; | ||
|
||
return { | ||
restrict: 'ACE', | ||
link: function (scope, element, attr) { | ||
var top = angular.element($window)[0].screenTop, | ||
origHeight = angular.element($window)[0].screen.height, | ||
height = (origHeight * 0.7); | ||
|
||
// bind the digest cycle to be triggered by the scroll event | ||
// when it exceeds a threshold | ||
angular.element($window).bind('scroll', function () { | ||
if (angular.element($window)[0].pageYOffset >= (height)) { | ||
|
||
// show the spinner when triggered | ||
//scope.spinner.hide = !scope.spinner.hide; | ||
|
||
angular.element($window)[0].requestAnimationFrame(function () { | ||
// invoke the function passed into the 'whenScrolled' attribute | ||
scope.$apply(attr.mvLoadOnScroll); | ||
|
||
// increment the threshold | ||
height += (origHeight * 1.5); | ||
.directive("infiniteScroll", [ | ||
'$rootScope', '$window', '$timeout', | ||
function ($rootScope, $window, $timeout) { | ||
"use strict"; | ||
return { | ||
link: function (scope, elem, attrs) { | ||
var checkWhenEnabled, handler, scrollDistance, scrollEnabled; | ||
$window = angular.element($window); | ||
scrollDistance = 0; | ||
if (attrs.infiniteScrollDistance !== null) { | ||
scope.$watch(attrs.infiniteScrollDistance, function (value) { | ||
scrollDistance = parseInt(value, 10); | ||
return scrollDistance; | ||
}); | ||
} | ||
}); | ||
} | ||
|
||
}; | ||
}]); | ||
scrollEnabled = true; | ||
checkWhenEnabled = false; | ||
if (attrs.infiniteScrollDisabled !== null) { | ||
scope.$watch(attrs.infiniteScrollDisabled, function (value) { | ||
scrollEnabled = !value; | ||
if (scrollEnabled && checkWhenEnabled) { | ||
checkWhenEnabled = false; | ||
return handler(); | ||
} | ||
}); | ||
} | ||
handler = function () { | ||
var elementBottom, remaining, shouldScroll, windowBottom, | ||
win = $($window), | ||
el = $(elem); | ||
|
||
windowBottom = win.height() + win.scrollTop(); | ||
elementBottom = el.offset().top + el.height(); | ||
remaining = elementBottom - windowBottom; | ||
shouldScroll = remaining <= win.height() * scrollDistance; | ||
if (shouldScroll && scrollEnabled) { | ||
if ($rootScope.$$phase) { | ||
return scope.$eval(attrs.infiniteScroll); | ||
} else { | ||
return scope.$apply(attrs.infiniteScroll); | ||
} | ||
} else if (shouldScroll) { | ||
checkWhenEnabled = true; | ||
return checkWhenEnabled; | ||
} | ||
}; | ||
$window.on('scroll', handler); | ||
scope.$on('$destroy', function () { | ||
return $window.off('scroll', handler); | ||
}); | ||
return $timeout((function () { | ||
if (attrs.infiniteScrollImmediateCheck) { | ||
if (scope.$eval(attrs.infiniteScrollImmediateCheck)) { | ||
return handler(); | ||
} | ||
} else { | ||
return handler(); | ||
} | ||
}), 0); | ||
} | ||
}; | ||
} | ||
]); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
<p>Movie details</p> | ||
<p><a href='#/popular'>Back</a></p> | ||
<p> | ||
{{movie.id}} | ||
</p> | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.