Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

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
Javascript :: where from terminal colors come 
Javascript :: angularjs select placeholder 
Javascript :: javascript canvas load image 
Javascript :: add new value to array of object javascript using spread 
Javascript :: white with opacity rgba to hex 
Javascript :: hide react source 
Javascript :: curl to javascript fetch 
Javascript :: requestanimationframe in javascript 
Javascript :: array js 
Javascript :: document.addeventlistener 
Javascript :: javascript array looping 
Javascript :: building an array of a numbers javascript 
Javascript :: js upload file size limit 
Javascript :: setting up a react environment 
Javascript :: Bracket Notation Example 
Javascript :: vue js tutorial csv import 
Javascript :: render and mount functional component 
Javascript :: rxjs coding example 
Javascript :: how to create module in react 
Javascript :: LEAODE MAJE 
Javascript :: js Changing selected option by option text 
Javascript :: is js dead 
Javascript :: json api data fetch error 
Javascript :: denuncia perturbação 
Python :: check if tensorflow gpu is installed 
Python :: how to change django admin text 
Python :: how to change the scale of a picture in pygame 
Python :: python datetime tomorrow date 
Python :: python measure time 
Python :: How to have add break for a few seconds in python 
ADD CONTENT
Topic
Content
Source link
Name
1+8 =