How to download an item on the site, only when the window size, for example, is less than 320px? It is to download, not display.

  • @Prodius, According to the rules of the forum, questions should not be reduced to the decision or the completion of student assignments. Please clarify what you have done yourself and what did not work out. - avengerweb

1 answer 1

Hang an event on $ (window) .resize (); inside it, get the viewport size $ ('html'). width (); set the condition, if the size is <321 then load the element $ ('. mydiv'). load ('/ h / myurl.html'); and don't forget to "trigger" the event upon initialization, like this: $ (document) .ready (function () {$ (window) .trigger ('resize');});

  • Well, in general, they do not do that, usually display: none / block, depending on the css media query, is more than enough!