By
05/13/2016   Comments Off on Conditional jQuery based off of media queries

View all snippets

The highlighted media queries are what the script will look for to load any additional jQuery scripts and commands. Change these lines to whatever you’d like. Then place whatever script that will be executed inside.

jQuery(document).ready(function() {
   checkSize(); jQuery(window).resize(checkSize); function checkSize(){
      if (jQuery('.header-two').css('display') == 'block'){
          // jQuery rules here
      }
      if (jQuery('.header-two').css('display') == 'none'){
         // JQuery rules here
      }
   };   
});