Disable media css

Original by reinie, 2016 

This summary note was Posted on

There are several ways:

With CSS

  • Add a class to your or such as class="force-desktop"
  • Add the following css

@media () { body:not(.force-desktop) { //styles } }

With Javascript

Using the viewport property (only on mobile devices, not recognised by desktop browsers)

$(document).ready(function(){
   $('meta[name="viewport"]').prop('content', 'width=1440');
});

Javascript and css

  • Out css you want to disable in a separate css file
  • and disable/able the css file with javascript as you need towitht he following:
function toggleSheet(title){
  var S=document.styleSheets, L=S.length, temp;
  while(L){
    temp=S[--L];
    if(temp.title===title){
    temp.disabled=!temp.disabled;
    return temp;
  }  
}

Source: Stackoverflow forum