get scrolling to work better

This commit is contained in:
Colin Frei 2013-08-13 18:23:01 +02:00
parent 6f0478bb25
commit d9229bbd18
3 changed files with 29 additions and 12 deletions

View file

@ -169,7 +169,7 @@ body, .normalFont {
float: right;
}
#queueList, #scroller {
#queueList, #scroller, #feedList {
height: 100%;
}

View file

@ -1,5 +1,5 @@
angular.module('podcast.directives', [])
.directive('pullToRefresh', function() {
.directive('pullToRefresh', ['$timeout', function($timeout) {
return function(scope, element, attrs, feedItems) {
var myScroll,
pullDownEl, pullDownOffset,
@ -54,11 +54,15 @@ angular.module('podcast.directives', [])
scope.$watch(
function() { return scope.queue; },
function() { myScroll.refresh(); },
function() {
$timeout(function() {
myScroll.refresh();
}, 5);
},
true
);
}
})
}])
.directive('hold', ['$timeout', function($timeout) {
return function(scope, element, attrs) {
var startTime, moved, holdTimer = false;
@ -84,8 +88,19 @@ angular.module('podcast.directives', [])
}
}])
.directive('scroll', function() {
return function(scope, element, attrs, feedItems) {
var scroll = new iScroll(element[0], {vScrollbar: false});
return {
priority: -1000,
compile: function compile(tElement, tAttrs) {
return function postLink(scope, element, attrs, feedItems) {
//TODO: this should probably work somehow without setting a timeout
// - need to be able to set the order of watchers?
setTimeout(function() {
console.log('bla');
console.log(element[0]);
var scroll = new iScroll(element[0], {vScrollbar: false});
}, 500);
}
}
};
})
.directive('blob', function() {

View file

@ -1,9 +1,11 @@
<div>
<form ng-submit="addFeed()">
<input type="text" class="newFeedField" ng-model="newFeedUrl" placeholder="Add Feed" ng-blur="removePrefillIfNecessary()" ng-focus="preFillField()" /><input type="submit" value="Add" />
</form>
<div id="feedList" scroll>
<div>
<form ng-submit="addFeed()">
<input type="text" class="newFeedField" ng-model="newFeedUrl" placeholder="Add Feed" ng-blur="removePrefillIfNecessary()" ng-focus="preFillField()" /><input type="submit" value="Add" />
</form>
<div ng-repeat="feed in feeds | orderBy:'title'" class="listItem" ng-click="goToFeed(feed.id)">
<img blob="feed.image" class="feedImageThumbnail" /> <span class="listItemTitle">{{feed.title}}</span>
<div ng-repeat="feed in feeds | orderBy:'title'" class="listItem" ng-click="goToFeed(feed.id)">
<img blob="feed.image" class="feedImageThumbnail" /> <span class="listItemTitle">{{ feed.title }}</span>
</div>
</div>
</div>