kopia lustrzana https://github.com/FacilMap/facilmap
17 wiersze
382 B
JavaScript
17 wiersze
382 B
JavaScript
fm.app.directive("fmScrollToView", (fmUtils) => {
|
|
return {
|
|
restrict: 'A',
|
|
link: (scope, element, attrs) => {
|
|
let wasActiveBefore = false;
|
|
scope.$watch(attrs.fmScrollToView, (scrollToView) => {
|
|
scrollToView = !!scrollToView;
|
|
|
|
if(scrollToView && !wasActiveBefore) {
|
|
fmUtils.scrollIntoView(element);
|
|
}
|
|
|
|
wasActiveBefore = scrollToView;
|
|
});
|
|
}
|
|
};
|
|
}); |