Change vh by px

0

I'm having the following problem:

I have a page that has several slides in HTML itself. All of these slides have their size set to vh instead of pixel .

The problem is that when I access with mobile, the cell being horizontal is fine, but when I put it vertically it does not display the slide I was in, it does the vh recalculation due to the orientation change of the mobile, and move on to the next slide.

Firstly I thought about disabling the mobile screen transition via javascript, but it seems to be gambi .

How can I see if the site is being accessed by mobile and run a function in javascript so that it replaces everything that has vh to pixel ?

I do not know if this is the best option, if anyone has a suggestion I am very grateful.

    
asked by anonymous 26.04.2017 / 17:47

1 answer

2

Switching VH by Pixels has yes, by Media Queries. It would be a way of applying styles when the user accesses the contents of a different device. This is a basic example you should look into.

@media only screen and (max-width: 480px) {
    body {
        width: 100px;
    }
}

This CSS says that when the user accesses your site from a browser that has a screen smaller than 480px, the body will be 100px wide. With a little research and work you can adapt it to your need.

The big question is whether you have another preferable way of solving your situation.

    
26.04.2017 / 17:57