How to determine the direction of scroll on the page?

How to determine the direction of scroll on the page?

05.04.20
Using jQuery, you can do this: let lastScrollTop = 0; $(window).on('scroll', function(){ let top = $(this).scrollTop(); if (lastScrollTop > top) { console.log('top'); } else if (lastS...
How to add a favicon to your website

How to add a favicon to your website

22.03.20
A favicon is a website icon. The easiest way to add it to the page is to put an icon with the name favicon.ico 16x16 pixels in the root of the site. Or set a path by writing one line in a section <head> <link...
How to detect the operating system using javascript

How to detect the operating system using javascript

06.03.20
Sometimes it is necessary to determine the user's operating system. Example: Your OS is your os function detectOS() { const platform = navigator.platform.toLowerCase(), iosPlatforms = ['iphone', 'ipad'...
Work with cookies in JavaScript

Work with cookies in JavaScript

29.02.20
Сookie (web cookie or browser cookie) is a string of information that can be stored in a browser and sent to the server. The maximum size for one cookie is 4096 bytes. The number of cookies for one domain can be from ...
Promises in the loop

Promises in the loop

30.12.19
Consider an example of performing promises in a loop. In this task, the execution order was not important. let promises = []; removedList.forEach(param => { promises.push( this.apiMethod(param.uid).toPro...
[12 3 4 5  >>