2017-02-12 8 views
1

문제 : 아래 그림은 부분적으로 전체 화면에 불과합니다. 전체 화면에서 화면의 전체보기 영역을 채우기 위해이 요소를 늘리는 방법은 무엇입니까?요소가 완전히 전체 화면으로 돌아 가지 않음

Plot in fullscreen

I가 사용하고있는 풀 스크린 기능 : 전체 화면에

function toggleFullscreen(elem) { //function to make element (cell) fullscreen on most browsers 
     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); 
     } 
     } 
    } 

콜백 : 또한

var $saved_cell = $('.cell.code_cell.rendered.selected > div.output_wrapper > div.output > div > div.output_subarea.output_html.rendered_html'); 

$saved_cell.each(
     function() { toggleFullscreen(this) }).css({ 
      'background-color' : 'rgb(244,244,244)', 
      'position': 'absolute', 
      'z-index': '9999', 
      'min-width': '100%', 
      'height': '100vh', 
      'margin': '0', 
      'padding': '0', 
      'overflow': 'auto' 
     }); //expand selected cell 

여기 선택된 요소 주위 DOM의 스크린 샷이다

DOM

답변

0

그래픽 <svg> 항목 자체에 설정된 너비와 높이를 변경하거나 제거해야합니다. 단순히 div를 크게 만들면 그래픽의 크기가 자동으로 조정되지 않습니다.

다른 접근법은 아마 <div class="svg-container" ...>에서 자식 노드를 복사하여 표시하거나 숨길 수있는 100 % 수있는 다른 컨테이너에 넣을 수 있습니다. 너비와 높이를 복사 된 <svg> 요소에 적용하여 고정되지 않도록하고보기를 전체 화면으로 토글합니다. 이렇게하면 유지하려는 '정상적인'견해를 엉망으로 만들지 않습니다.

당신이 사용할 수있는 jQuery의 .find().clone()당신이 100 %로 표시 할 공간에 복사합니다 (대신에 불쾌한 구조를 걸을 시도의) 위에서 언급 한 사업부에 도착합니다. 그런 다음 원하는 너비와 높이의 <svg>을 조작하십시오.