Define css if javascript is not enabled

前端 未结 8 1659
无人共我
无人共我 2020-12-10 14:58

I want to define .exampleclass img {height:250px} if javascript is not enabled. Is their anyway to undo this in javascript / jquery?

8条回答
  •  忘掉有多难
    2020-12-10 15:28

    One day we may have this

    Not currently active in Chrome 83 Win10

    https://developer.mozilla.org/en-US/docs/Web/CSS/@media/scripting

    p {
      color: lightgray;
    }
    
    @media (scripting: none) {
      .script-none {
        color: red;
      }
    }
    
    @media (scripting: initial-only) {
      .script-initial-only {
        color: red;
      }
    }
    
    @media (scripting: enabled) {
      .script-enabled {
        color: red;
      }
    }

    You do not have scripting available. :-(

    Your scripting is only enabled during the initial page load. Weird.

    You have scripting enabled! :-)

提交回复
热议问题