M
M
Maxim2017-08-21 11:55:14
JavaScript
Maxim, 2017-08-21 11:55:14

How to dynamically update Angular2 screen size?

I have an animation that goes on the screen for 2 seconds. But when the screen size is small, then these 2 seconds of animation do not look very nice. I would like to somehow adjust this interval depending on the size of the browser window and, moreover, dynamically. Suddenly a person turns the device upside down, the size of the browser is not the same.
Are there ways to dynamically listen to screen data, or are there other ways to solve the problem?
My streaming attempts:

size = Observable.create((observer) => {
      observer.next(window.screen.availWidth)

  })

constructor(private size: ScreenSizeService ) { }
this.size.size.subscribe(data => { console.log(data)});

Answer the question

In order to leave comments, you need to log in

1 answer(s)
I
Ivan Stroykin, 2017-08-21
@american6oy

What about the standard way? example

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question