简体   繁体   中英

Chrome not detecting fullscreen change

I am trying to remove a class from an element when the user presses escape and exits full screen on chrome. My code:

document.addEventListener('onwebkitfullscreenchange', 

  function(e)
  {
    console.log("sanity check")
    if ($('#someDiv').hasClass('aClass'))
    {
      $('#someDiv').removeClass('aClass');
    }
  }
);

What am I missing here? I never see the "sanity check" output either. Nothing happens.

Just checked in F11 mode.

    if( window.innerHeight == screen.height) {
    console.log("sanity check")
    }

It only works in FullScreen mode.

When I typed, I didn't see @dxcorzo's comment, sorry. It just links to same answer. Credit goes to @dxcorzo :)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM