[Monitor Dashboard | Trunk]: 1. Add smooth js for safari/ie/edge 2. Inject new smooth scroll service on app component. 3. remove configuration about scrolling at navigation start
git-svn-id: https://svn.driver.research-infrastructures.eu/driver/dnet40/modules/uoa-monitor-portal/trunk/monitor_dashboard@60845 d315682c-612b-4755-9ff5-7f18f6832af3
This commit is contained in:
parent
27a916e609
commit
f8a1bebc29
|
@ -61,7 +61,6 @@ const routes: Routes = [
|
|||
@NgModule({
|
||||
imports: [RouterModule.forRoot(routes, {
|
||||
preloadingStrategy: PreloadAllModules,
|
||||
scrollPositionRestoration: "top",
|
||||
onSameUrlNavigation: "reload",
|
||||
relativeLinkResolution: 'corrected'
|
||||
})],
|
||||
|
|
|
@ -15,6 +15,7 @@ import {properties} from "../environments/environment";
|
|||
import {ConfigurationService} from "./openaireLibrary/utils/configuration/configuration.service";
|
||||
import {Option} from "./openaireLibrary/sharedComponents/input/input.component";
|
||||
import {StakeholderUtils} from "./utils/indicator-utils";
|
||||
import {SmoothScroll} from "./openaireLibrary/utils/smooth-scroll";
|
||||
|
||||
|
||||
@Component({
|
||||
|
@ -61,6 +62,7 @@ export class AppComponent implements OnInit, OnDestroy {
|
|||
private router: Router,
|
||||
private userManagementService: UserManagementService,
|
||||
private layoutService: LayoutService,
|
||||
private smoothScroll: SmoothScroll,
|
||||
private stakeholderService: StakeholderService,
|
||||
private cdr: ChangeDetectorRef, private configurationService: ConfigurationService) {
|
||||
this.subscriptions.push(this.router.events.subscribe(event => {
|
||||
|
@ -208,6 +210,7 @@ export class AppComponent implements OnInit, OnDestroy {
|
|||
this.layoutService.clearSubscriptions();
|
||||
this.stakeholderService.clearSubscriptions();
|
||||
this.configurationService.clearSubscriptions();
|
||||
this.smoothScroll.clearSubscriptions();
|
||||
}
|
||||
|
||||
private navigateToError() {
|
||||
|
|
|
@ -222,24 +222,10 @@ export class MethodologyComponent implements OnInit, OnDestroy {
|
|||
this._meta.updateTag({content: description}, "property='og:description'");
|
||||
this._meta.updateTag({content: title}, "property='og:title'");
|
||||
this._title.setTitle(title);
|
||||
this.subscriptions.push(this.route.fragment.subscribe(fragment => {
|
||||
setTimeout(() => {
|
||||
this.goTo(fragment);
|
||||
}, 100);
|
||||
}));
|
||||
}
|
||||
}));
|
||||
}
|
||||
|
||||
goTo(id: string) {
|
||||
const yOffset = -100;
|
||||
const element = document.getElementById(id);
|
||||
if (element) {
|
||||
const y = element.getBoundingClientRect().top + window.pageYOffset + yOffset;
|
||||
window.scrollTo({top: y, behavior: 'smooth'});
|
||||
}
|
||||
}
|
||||
|
||||
ngOnDestroy() {
|
||||
this.subscriptions.forEach(subscription => {
|
||||
if (subscription instanceof Subscription) {
|
||||
|
|
|
@ -32,6 +32,7 @@
|
|||
</div>
|
||||
</body>
|
||||
<script src="https://cdn.ckeditor.com/4.5.11/full-all/ckeditor.js"></script>
|
||||
<script src="https://unpkg.com/smoothscroll-polyfill@0.4.3/dist/smoothscroll.min.js"></script>
|
||||
<script type="text/javascript">
|
||||
function loadAltmetrics(e, t, n) {
|
||||
var d = "createElement", c = "getElementsByTagName", m = "setAttribute", n = document.getElementById(e);
|
||||
|
|
|
@ -31,6 +31,7 @@
|
|||
</div>
|
||||
</body>
|
||||
<script src="https://cdn.ckeditor.com/4.5.11/full-all/ckeditor.js"></script>
|
||||
<script src="https://unpkg.com/smoothscroll-polyfill@0.4.3/dist/smoothscroll.min.js"></script>
|
||||
<script type="text/javascript">
|
||||
function loadAltmetrics(e, t, n) {
|
||||
var d = "createElement", c = "getElementsByTagName", m = "setAttribute", n = document.getElementById(e);
|
||||
|
|
Loading…
Reference in New Issue