Answer the question
In order to leave comments, you need to log in
How is jQuery code distributed between different versions of a responsive layout?
Good afternoon.
I'm learning adaptive layout. As for css, everything is very clear and there were no questions, but jQuery in the adaptive layout does not give me peace. There is an object, for example. On the desktop, several events are hung on the object, but on mobile phones, these events should no longer fire. How to act correctly in such cases? Is it really possible to hang an onresize event on the window and set a variable when a certain point passes between the desktop version and the mobile one? Those. events on desktop and mobile should be different. How to do it right - I don’t know yet, but I will always have time to put together crutches, but this will not give progress.
The second question is the transfer of objects in the DOM. It so happened that in the desktop and mobile versions, one object is located in completely different places. Is there a practice when using JS we drag a piece of code back and forth?
I will be very grateful for your answers. I hope for understanding and lack of agra :-)
Answer the question
In order to leave comments, you need to log in
one.
On the desktop, several events are hung on the object, but on mobile phones, these events should no longer fire.
h = windows.height
w = windows.width
$(window).resize(function() {
h = windows.height;
w = windows.width;
});
It so happened that in the desktop and mobile versions, one object is located in completely different places.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question