S
S
Sergey Goryachev2015-10-25 15:43:17
css
Sergey Goryachev, 2015-10-25 15:43:17

How to execute a script on screen rotation?

How to hide div block when changing screen orientation?
Let's say a person visits the site from a phone, opens the menu, rotates the screen.
You need to hide the menu when you rotate.
Tried

jQuery(window).resize(function () {
jQuery("#mainmenu").hide(0);
});

But then I was in pain.
The menu is large and when scrolling on phones it disappears.

Answer the question

In order to leave comments, you need to log in

3 answer(s)
V
Vitaly Inchin ☢, 2015-10-25
@webirus

nikitakiselev.ru/post/42

P
Pavel Torbeev, 2015-10-25
@glizer

The media css property will help you more specifically the aspect-ratio parameter

F
Fayozzhon Berdiev, 2015-10-25
@CybernatiC

$(window).on('resize',function(){$('#mainmenu').hide()});

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question