Search
 
SCRIPT & CODE EXAMPLE
 

TYPESCRIPT

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
}
    
Comment

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 { }
}
Comment

scroll position

$(window).scroll(function() {
	var $height = $(window).scrollTop();
  if($height > 50) {
		//do something
	} else {
		//do something
	}
});
Comment

PREVIOUS NEXT
Code Example
Typescript :: mongodb nest.js 
Typescript :: date formats in mongodb 
Typescript :: convert javascript to typescript 
Typescript :: ERROR in The Angular Compiler requires TypeScript =3.4.0 and <3.6.0 but 4.1.5 was found instead. 
Typescript :: typescript 
Typescript :: Search test by start and end 
Typescript :: obsidian write file 
Typescript :: disable srr svelteKit 
Typescript :: how to print brackets characters in c# 
Typescript :: nest js crons intialization 
Typescript :: ipywidgets popup window 
Typescript :: sort even dont exists meta wordpress 
Typescript :: typescript public function 
Typescript :: saving leaderstats script roblox 
Typescript :: file attachements contac form 7 
Typescript :: React import multiple components from a folder 
Typescript :: class-transformer change property names 
Typescript :: typescript custom number no greater than x 
Typescript :: typescript get string value of enum 
Typescript :: nativescript routerextensions navigate 
Typescript :: mergensherts meaning 
Typescript :: deno allow net 
Typescript :: serenity framework break form 
Typescript :: react dynamic inputs with id 
Typescript :: object map of the http parameters mutually exclusive with fromString 
Typescript :: array elements double next to each other 
Typescript :: minimum requirements to start it company 
Typescript :: how to take list as command line arguments in python 
Typescript :: how to delete a struct in a arra of strcts c 
Typescript :: how to call a function in a macro with variadic arguments c++ 
ADD CONTENT
Topic
Content
Source link
Name
6+7 =