ãã«ã¹ã¯ãªã¼ã³ã»ã¢ã¼ã使ããã楽ã ã
æ¨ä»ã®ãã©ã¦ã¶ã«ã¯ãã«ã¹ã¯ãªã¼ã³ã¢ã¼ããæè¼ããã¦ãã¦ãããã使ãã¨ãã³ããã¬ãã«ã§ç»åãæ¡å¤§è¡¨ç¤ºãåºæ¥ã
ç»åããã«ã¹ã¯ãªã¼ã³ã«ãæ軽ã«ä½ãHTMLã®ä¾
<div id='img01' onclick="this.webkitRequestFullScreen();" > <img src='http://cdn-ak.f.st-hatena.com/images/fotolife/t/takuya_1st/20141129/20141129034938.jpg' /> </div> <button onclick="img01.webkitRequestFullScreen();">ãã«ã¹ã¯ãªã¼ã³ã§è¡¨ç¤º</button>
#img01:-webkit-full-screen { width: 80%; background-color: rgba(255,0,0,0.1); } #img01:-webkit-full-screen img { display: block; margin: 10% auto; cursor: pointer; } #img01 img { max-width: 50%; cursor: pointer; }
å®ä¾ã¯ã³ã¬
ãã«ã¹ã¯ãªã¼ã³ã¯çµæ§ä¾¿å©ã
ãã«ã¹ã¯ãªã¼ã³ã£ã¦çµæ§ä¾¿å©ãªãã§ããããããã£ã¦ãè²ã ãªã¨ããã§ä½¿ããã¦ã¦ãããããä¾ã ã¨ãåç»ãã§ããåç»ãå ¨ç»é¢åçãããã¨ãã«ä½¿ãã¾ããã
ãã©ã¦ã¶ã®å®è£ çã«ã¯ãããã¯ä»»æã®è¦ç´ ããã«ã¹ã¯ãªã¼ã³ã«è¡¨ç¤ºããã£ã¦ãã¨ã§ãã
ããã«ããã°ãè¦ç´ ã®é«ãã»å¹ ãã¦ã¤ã³ãã¦ã®ã¹ã¯ãªã¼ã³ãµã¤ãºã«åãããã£ã¦ãã¨ãå ¨ç»é¢ã ããã£ã¦å¤§ãããã¨ããã¦ããªãã
ãã«ã¹ã¯ãªã¼ã³ã¢ã¼ãã¨åçã®Javascriptãæ¸ãã¨ãããªãã
// ãã«ã¹ã¯ãªã¼ã³ã¢ã¼ãã¨ã¯screen ã«æããã㨠div = document.querySelector("#my_element") div.style.width = window.screen.width div.style.height = window.screen.height //ããã¯ããã£ã½ãè¦ãããã¾ããªãã //div.style.position = "fixed" //div.style.top = "0px" //div.style.left = "0px" //div.style.zIndex = "100" //div.style.overflow = "hidden" //img = document.querySelector("#my_element img") //img.style.maxWidth="50%"
ãã©ã¦ã¶ããã£ã¦ããã¨ã¯ã ããããããªãããã ã£ãã
JSã§æ¸ããããæç¶ãã«ã¹ã¯ãªã¼ã³ã¢ã¼ããCSSã§å®å ¨ã«å¶å¾¡ã§ããã
å¶å¾¡ã楽
å ¨ç»é¢ã«ãããè¦ç´ ã« onclick ããã ããããã¼æ¥½ã¡ããè¦ããã®ã楽ã¡ã
<element onclick="this.webkitRequestFullScreen();
CSSã®æ¬ä¼¼ã»ã¬ã¯ã¿ãæå¹ã«ãªãã
*:-webkit-full-screen { width:100%; height:100%; }
æ¬ä¼¼è¦ç´ ã»ã¬ã¯ã¿ã使ããã®ãããããããã¦ãããã¯ã©ã¹åã®æ±æã¨ãdataå±æ§ã¨ãèããªãã¦ãã
ã©ããªè¦ç´ ã§ããã«ã¹ã¯ãªã¼ã³ã«ã§ãã
è¦ç´ ãæå®ãã¦ãã«ã¹ã¯ãªã¼ã³ã«ããã®ã§ã対象ã®è¦ç´ ã¯ãªãã§ãããã
LigithBoxã«åç»åãããã¾ããï¼ãã©ãã·ã¥ã¯ï¼ã¨ããããããã¨èããåã«ãããã£ã¨å®è£ ãããã
JSæ¢ãã¦ãããã絶対æ©ãããï¼
2014-11-29 è¿½è¨ ã©ããªè¦ç´ ã§ãã§ããã
ã³ã¡ã³ãè¦ãããã¢ã¼ãã«ãã¤ã¢ãã°ãï¼ã¨ãè¨ã£ã¦ãã®ï¼ããããã¦ãç»åãåç»ãã表示ã§ããªãã¨æã£ã¦ãªãï¼å ¨ç»é¢ã£ã¦ç«æ´¾ãªã¢ã¼ãã«ãã¤ã¢ãã°ã§ãä½ããã¨æããã§ããã©ããã¡ãªãã§ããï¼
ã¹ã¯ãã¼ã«éã¨ãèããªãã¦ãã
CSSããã¼ã¸ã®ãã¶ã¤ã³ã®é½åä¸ãã¼ã¸ã³ã¨ããä¸æ¸ãã¨ãç´°ãããã¨ã§ãæ¢åã®JSãåããªããªããã¨ããããã
æ°ãã¯ã»ã«ãããããã¹ã¯ãªã¼ã³ãµã¤ãºãæ°ã«ããããã¹ã¯ãã¼ã«æã«ç»å表示ããããããªã£ããã誰ããCSSä¸æ¸ããã¦å´©ãã¦ããã
å°ããªãºã¬æ°ã«ããªãã¦ããããï¼
ãã«ã¹ã¯ãªã¼ã³ç¨ã«ãªã»ããCSSãæ¸ãã¡ãã£ã¦ãä»ã«ã¯å½±é¿ããªãã
fullscreenèµ·åã®æ³¨æç¹
ã¦ã¼ã¶ã¼ã®ã¢ã¯ã·ã§ã³ã§ããåä½ããªããã³ã³ã½ã¼ã«ããã¯èµ·åã§ããªãããã¼ã¸ãã¼ãã§ã¤ãããªãã«ã¹ã¯ãªã¼ã³ã¨ã絶æããããããããåºæ¥ãªãã£ãã
jquery ã®ãã¼ã¸ã§ã³å°ç
lightbox ç³»ã®ããã«jquery ã®éããã¼ã¸ã§ã³ãã¬ã³ã¬ã³ã¨HTMLã«åãè¾¼ãã®ããã¦ãã ããã
åèè³æ
https://developer.mozilla.org/en-US/docs/Web/Guide/API/DOM/Using_full_screen_mode
2014-11-29 追è¨
ãã³ããã¬ãã£ãã¯ã¹ãããã¨ä½ç´ãªã®ï¼ï¼
ç ½ãããã®ã§ãç ½ãè¿ãã¦ããã¾ãããMDNãè³æã§ä¸ãã¦ããã ãããMDNã®ãµãã¼ãã«ãã³ããã¬ãã£ãã¯ã¹ãªãã§åä½ããªããã¨ãããæ¸ãã¦ããã®èªããããï¼ã¨ããããèªåã®ç°å¢(OSX yosemite+Opera/chormeï¼ã§åããã®ã§æ¸ãã¾ããã
2014-11-29 追è¨å ¨ç»é¢è¡¨ç¤ºã®å®è£ ã¯ãã©ã¦ã¶ä¾å
ã¡ãªã¿ã«ãChromeã ã¨å ¨ç»é¢è¡¨ç¤ºã ãã©ãOSX Operaãªãæ大åã§ãã¬ã¼ã³ãã¼ã·ã§ã³ã¢ã¼ããªãã ãã
å ¨ç»é¢ã§PCç»é¢å æ ããã®ã¯Chromeã®å®è£ ãæªãã¨æãã¾ãã