Call external JS file based on “media screen” value
问题 I\'m trying this but it is not working: <html> <head> <script src=\"js/menu-collapser.js\" type=\"text/javascript\" media=\"media screen and (max-width: 599px)\"></script> </head> ... </html> //menu-collapser.js : jQuery(document).ready(function($){ $(\'.main-navigation li ul\').hide(); $(\'.main-navigation li\').has(\'ul\').click(function() { $(this).children().toggle(); }); }); Do you have an idea on how to do this in the right way? The script work if used directly in the header with the