javascript get scroll position
function getYPosition(){
var top = window.pageYOffset || document.documentElement.scrollTop
return top;
}
javascript get scroll position
function getYPosition(){
var top = window.pageYOffset || document.documentElement.scrollTop
return top;
}
window log scrollpostion
$(window).on('scroll', function() {
console.log( $(this).scrollTop() );
});
scroll position
$(window).scroll(function() {
var $height = $(window).scrollTop();
if($height > 50) {
//do something
} else {
//do something
}
});
Scroll, Position
abstract class ViewportScroller {
abstract setOffset(offset: [number, number] | (() => [number, number])): void
abstract getScrollPosition(): [number, number]
abstract scrollToPosition(position: [number, number]): void
abstract scrollToAnchor(anchor: string): void
abstract setHistoryScrollRestoration(scrollRestoration: "auto" | "manual"): void
}
Scroll,Position
import { HostListener } from '@angular/core';
@ViewChild('curtain') divCurtain: ElementRef;
export class ComponentX {
@HostListener('window:scroll', ['$event']) onScrollEvent($event) {
console.log(window.pageYOffset);
this.divCurtain.nativeElement.style.top = window.pageYOffset.toString().concat('px');
}
ngOnInit(): void { }
}
Copyright © 2021 Codeinu
Forgot your account's password or having trouble logging into your Account? Don't worry, we'll help you to get back your account. Enter your email address and we'll send you a recovery link to reset your password. If you are experiencing problems resetting your password contact us