mirror of
https://github.com/Athou/commafeed.git
synced 2026-03-21 21:37:29 +00:00
scroll to entry when opened
This commit is contained in:
@@ -1,5 +1,23 @@
|
||||
var module = angular.module('commafeed.directives', []);
|
||||
|
||||
module.directive('scrollTo', function() {
|
||||
return {
|
||||
restrict : 'A',
|
||||
controller : function($scope, $element, $attrs) {
|
||||
|
||||
},
|
||||
link : function(scope, element, attrs) {
|
||||
scope.$watch(attrs.scrollTo, function(value) {
|
||||
if (value) {
|
||||
$('html, body').animate({
|
||||
scrollTop : $(element).offset().top + 'px'
|
||||
}, 'fast');
|
||||
}
|
||||
});
|
||||
}
|
||||
};
|
||||
});
|
||||
|
||||
module.directive('subscribe', function(SubscriptionService) {
|
||||
return {
|
||||
scope : {},
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
|
||||
<div infinite-scroll="loadMoreEntries()" infinite-scroll-disabled="busy || !settingsService.settings.readingMode" infinite-scroll-distance="1" id="feed-accordion">
|
||||
<div ng-repeat="entry in entries" class="entry">
|
||||
<a href="{{entry.url}}" target="_blank" class="entry-heading" ng-click="entryClicked(entry, $event)"
|
||||
<a scroll-to="isOpen && current == entry" href="{{entry.url}}" target="_blank" class="entry-heading" ng-click="entryClicked(entry, $event)"
|
||||
ng-class="{open: current == entry, closed: current != entry}">
|
||||
<span ui-if="selectedType == 'category'" class="feed-name">{{entry.feedName}}</span>
|
||||
<span class="entry-name" ng-class="{unread: entry.read == false}" ng-bind-html-unsafe="entry.title"></span>
|
||||
|
||||
Reference in New Issue
Block a user