Google Chrome - Image problem in full screen

Asked

Viewed 183 times

1

The original image is this: http://4k.com/wp-content/uploads/2014/06/4k-image-tiger-jumping.jpg

I’m wearing event click to call function "toggleFullscreen".

Follows the code:

Html:

<img id="image" width="450" height="350" src="http://4k.com/wp-content/uploads/2014/06/4k-image-tiger-jumping.jpg">

Script

<script type="text/javascript">
  $("#image").click(function() {
    toggleFullscreen(this);
  });

     function toggleFullscreen(elem) {
     elem = elem || document.documentElement;
     if (!document.fullscreenElement && !document.mozFullScreenElement &&
       !document.webkitFullscreenElement && !document.msFullscreenElement) {
       if (elem.requestFullscreen) {
         elem.requestFullscreen();
       } else if (elem.msRequestFullscreen) {
         elem.msRequestFullscreen();
       } else if (elem.mozRequestFullScreen) {
         elem.mozRequestFullScreen();
       } else if (elem.webkitRequestFullscreen) {
         elem.webkitRequestFullscreen(Element.ALLOW_KEYBOARD_INPUT);
       }
     } else {
       if (document.exitFullscreen) {
         document.exitFullscreen();
       } else if (document.msExitFullscreen) {
         document.msExitFullscreen();
       } else if (document.mozCancelFullScreen) {
         document.mozCancelFullScreen();
       } else if (document.webkitExitFullscreen) {
         document.webkitExitFullscreen();
       }
     }
   }

</script>

Problem: After clicking on the image, the image remains the same size as img tag. It is not leaving the original image like this: http://4k.com/wp-content/uploads/2014/06/4k-image-tiger-jumping.jpg in full screen.

Here it is in jsfiddle: https://jsfiddle.net/j1fxt7ct/1/

Some solution ?

  • For me it was full screen :/

  • here this working perfectly, the jsfiddle left fullscreen yes.

  • Calm down, I’ll print it out and send it to you

  • https://s27.postimg.org/emjmufspf/05_Dec_30_16_22.jpg

  • She left fullscreen yes, but the image of the tiger no

  • The problem is this: width="450" height="350", is making the image small.

  • I tested and the image was fullscreen, is not some configuration of your browser? Open in Firefox

  • Jeez because the problem is google Chrome ? The rest is ok

  • The tiger was fellscreen for me, I’m also using firefox @Matheusmiranda. Try it with another browser.

  • Firefox worked without problem.

  • Yes, @mauhumor, the problem is google Chrome

Show 6 more comments

1 answer

2


  • Hi Lucas Costa, almost ! The problem continues, follows :https://jsfiddle.net/j1fxt7ct/3/

  • When opening in full screen, it is setting height:350

  • https://s23.postimg.org/mlk1bblu3/06_Dec_30_16_40.jpg

  • Whether to fill the entire screen or not depends on the original image dimensions.

  • Maybe I made a difference because of the image format. I updated the reply @Matheusmiranda

  • As it can, a more popular browser with kkkk image problem

Show 1 more comment

Browser other questions tagged

You are not signed in. Login or sign up in order to post.