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 :: how to execute the same test case for multiple time using testng? 
Typescript :: benefits of ginger juice 
Typescript :: The create-react-app imports restriction outside of src directory 
Typescript :: difference known_hosts authorized_keys 
Typescript :: typescript different types support 
Typescript :: if a directive called 10000 times screen getting struck 
Typescript :: wifi disconnects frequently when downloading 
Typescript :: Rails flags for tests assets and helpers 
Typescript :: flights starting from in india 
Typescript :: function call in Angular using typescript creates infinite loop 
Typescript :: laravel Adding shipping rate to checkout session results in "invalid array" exception 
Typescript :: There are 7 components with misconfigured ETags 
Typescript :: CUSTOM_ELEMENTS_SCHEMA error occur while unit testing with jasmine and karma 
Typescript :: destroy object on collision phaser 
Typescript :: i like 
Typescript :: extracts lists from list python 
Typescript :: if its past 24 hrs *laravel 
Typescript :: components of selenium 
Typescript :: multer s3 file upload 
Typescript :: how to randomly generate a string in ts 
Typescript :: how to setup netflix workflow worker 
Cpp :: regex match all between parentheses 
Cpp :: ob for nginx.service failed because the control process exited with error code. See "systemctl status nginx.service" and "journalctl -xe" for details. 
Cpp :: celsius to kelvin formula 
Cpp :: sleep in cpp 
Cpp :: output coloured text in cpp 
Cpp :: how to sort in descending order c++ 
Cpp :: grpah class data structure 
Cpp :: map of vector of struct error 
Cpp :: how to know if two vertexes are connected in graph c++ 
ADD CONTENT
Topic
Content
Source link
Name
8+4 =