The topic itself is the whole question. It is necessary that the script worked only on large screens, did not work on small ones.

  • Read the documentation: github.com/jorenvanhee/EqualHeight.js . They write that this plugin is already DEPRECATED and I recommend using another one. So this other plugin has this function call: $('.item').matchHeight({ property: 'min-height' }); . I understand this is what you need. - MasterAlex

3 answers 3

Read the plugin documentation carefully: https://github.com/jorenvanhee/EqualHeight.js

It has a link to an example and in this example there is such a script:

 $(document).ready(function () { var equalHeight = $('.Grid--demo p').equalHeight({wait: true}); // Browser supports matchMedia if (window.matchMedia) { // MediaQueryList var mql = window.matchMedia("(min-width: 500px)"); // MediaQueryListListener var equalHeightCheck = function (mql) { if (mql.matches) { equalHeight.start(); } else { equalHeight.stop(); } }; // Add listener mql.addListener(equalHeightCheck); // Manually call listener equalHeightCheck(mql); } // Browser doesn't support matchMedia else { equalHeight.start(); } }); 

This case is not what you need?

They also write that this plugin is already DEPRECATED and recommend using another one: https://github.com/liabru/jquery-match-height .

And this other plugin has the functionality you need:

$('.item').matchHeight({ property: 'min-height' });

In general, choose, I personally would think when I would see that the plugin that I use is deprecated.

  • Thank you very much! - Alexander Suetin

Transfer the script from the file to the function and run it like this:

 function equalheight() { if (window.innerWidth > 1200) { /* при ширине экрана больше 1200 пикселей */ document.querySelector('header').style.display = 'none'; /* скрыть блок <header> */ } } window.addEventListener("load", adaptHeader); /* запускать при загрузке окна*/ window.addEventListener("resize", adaptHeader); /* запускать при ресайзе окна*/ 
  • Can you write more? - Alexander Suetin
  • @AlexanderSuetin added code with examples and comments - lexxl

Thank you very much! Wrote like this:

 if(document.documentElement.clientWidth > 800) { $('.eh').equalHeights() }