Experimental: ì´ ê¸°ë¥ì ì¤íì ì¸ ê¸°ë¥ì
ëë¤.
íë¡ëì
íê²½ìì ì¬ì©í기 ì ì ë¸ë¼ì°ì í¸íì± í를 주ì ê¹ê² íì¸íì¸ì.
Screen orientation ì device orientation ê³¼ë ì¡°ê¸ ë¤ë¥´ë¤. ë¹ë¡ ì¥ì¹ê° ë°©í¥ì ê°ì§ 못íëë¼ë íë©´ì ì¸ì ë ë°©í¥ì ê°ì§ê³ ìë¤. ê·¸ë¦¬ê³ ë§ì½ ì¥ì¹ê° ë°©í¥ì ì ì ìëë¼ë ì¹ ì´í리ì¼ì´ì ì ì¸í°íì´ì¤ë¥¼ ì ì§íê±°ë ì ìí기 ìí´ íë©´ì ë°©í¥ì ì¡°ì íë ë¥ë ¥ì ê°ëê² ì¢ë¤.
íë©´ì ë°©í¥ì ë¤ë£¨ê¸° ìí ì¬ë¬ ë°©ë²ì´ ìëë°, CSS ì JavaScript ì´ë¤. 첫 ë²ì§¸ë orientation media query ì´ë¤. ì´ê²ì ë´ì©ì´ CSS를 ì¬ì©í´ì ë ì´ììì ì¡°ì íê² íëë°, ë¸ë¼ì°ì ì°½ì´ ê°ë¡ 모ë (ëë¹ê° ëì´ë³´ë¤ í¼) ëë ì¸ë¡ëª¨ë (ëì´ê° ëë¹ë³´ë¤ í¼) ì¬ë¶ì ë¬ë ¤ ìë¤.
ëë²ì§¸ ë°©ë²ì JavaScript Screen orientation API ì¸ë° ì´ê²ì íë©´ì íì¬ ë°©í¥ì 구íê³ ì ê·¸ëë° ì¬ì©í ì ìë¤.
Adjusting layout based on the orientationë°©í¥ ë³íìì ê°ì¥ íí ì¼ì´ì¤ ì¤ íëë ì¥ì¹ì ë°©í¥ì ë°ë¼ ë´ì©ì ë ì´ììì ì¡°ì íë ê²ì´ë¤. ì를 ë¤ìë©´, ë¹ì ì ë²í¼ë°ë¥¼ ì¥ì¹ íë©´ì ê°ì¥ 긴 í¬ê¸°ë¡ í¼ì¹ê³ ì¶ì´ í ì ìëë°, media query를 ì´ì©í´ì ì½ê³ ìëì¼ë¡ í ì ìë¤.
ë¤ìì HTML code ìì 를 ë³´ì
<ul id="toolbar">
<li>A</li>
<li>B</li>
<li>C</li>
</ul>
<p>
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Duis lacinia nisi nec
sem viverra vitae fringilla nulla ultricies. In ac est dolor, quis tincidunt
leo. Cras commodo quam non tortor consectetur eget rutrum dolor ultricies. Ut
interdum tristique dapibus. Nullam quis malesuada est.
</p>
CSS ë íë©´ ë°©í¥ì ë°ë¼ í¹ì ì¤íì¼ì ì ë¤ë£¨ê¸° ìí´ orientation media query ì ìì¡´íë¤
/* First let's define some common styles */
html,
body {
width: 100%;
height: 100%;
}
body {
border: 1px solid black;
-moz-box-sizing: border-box;
box-sizing: border-box;
}
p {
font: 1em sans-serif;
margin: 0;
padding: 0.5em;
}
ul {
list-style: none;
font: 1em monospace;
margin: 0;
padding: 0.5em;
-moz-box-sizing: border-box;
box-sizing: border-box;
background: black;
}
li {
display: inline-block;
margin: 0;
padding: 0.5em;
background: white;
}
Once we have some common styles we can start defining a special case for the orientation
/* For portrait, we want the tool bar on top */
@media screen and (orientation: portrait) {
#toolbar {
width: 100%;
}
}
/* For landscape, we want the tool bar stick on the left */
@media screen and (orientation: landscape) {
#toolbar {
position: fixed;
width: 2.65em;
height: 100%;
}
p {
margin-left: 2em;
}
li + li {
margin-top: 0.5em;
}
}
ì¤í 결과를 ë³´ì
Portrait Landscapeì°¸ê³ : orientation media query ë ì¤ì ë¡ ë¸ë¼ì°ì ì°½ (ëë iframe) ì ë°©í¥ì ë°ë¼ ì ì©íë¤. ì¥ì¹ì ë°©í¥ì´ ìëë¤.
Locking the screen orientationê²½ê³ : ì´ API ë ì¤íì ì´ë©° íì¬ Firefox OS ì Firefox for Android ìì moz
ì ëì¬ë¥¼ ì´ì©íì¬ ì¬ì©í ì ìë¤.
ëªëª ì¥ì¹ë¤ì (ì£¼ë¡ ëª¨ë°ì¼ ì¥ì¹) ì¬ì©ìê° ì¸ì ë íë©´ì ì½ì ì ìê² ì¥ì¹ì ë°©í¥ì ë°ë¼ ëì ì¼ë¡ íë©´ì ë°©í¥ì ë³íìí¬ ì ìë¤. ë§ì½ ì´ë¬í íìê° í ì¤í¸ 컨í ì¸ ì ì í©íë¤ë©´, ì´ë¬í ë³í ë문ì ê³ íµ ë°ì ì ìë ì¼í ì¸ ë ìë¤. ì를 ë¤ì´, ì¥ì¹ì ë°©í¥ì ë°ë¥¸ ê²ìë¤ì ì´ë¬í ë°©í¥ì í ë문ì í¼ëì¤ë¬ì¸ ì ìë¤.
Screen Orientation API ë ì íí ê·¸ë¬í ë³í를 ë°©ì§í기 ìí´ ë§ë¤ì´ì¡ë¤.
Listening orientation changeorientationchange
ì´ë²¤í¸ë ì¥ì¹ê° íë©´ì ë°©í¥ì ë³íí ëì ë°©í¥ì´ screen.orientation
ìì±ê³¼ í¨ê» ì½íì§ ë ë§ë¤ ë¶ë ¤ ì§ë¤.
screen.addEventListener("orientationchange", function () {
console.log("The orientation of the screen is: " + screen.orientation);
});
Preventing orientation change
모ë ì¹ ì´í리ì¼ì´ì
ì íìì ë°ë¼ ì¤í¬ë¦°ì ì êµ´ ì ìë¤. íë©´ì screen.lockOrientation()
í¨ì를 ì¬ì©íì¬ ì ê·¸ê³ screen.unlockOrientation()
. í¨ìë¡ ì ê¸ í´ì íë¤.
screen.lockOrientation()
ë ì ì© í ì ê¸ì ì¢
ë¥ë¥¼ ì ìíë 문ìì´ (ëë ì¼ë ¨ì 문ìì´) ì ìì©íë¤. ìì©íë ê°ë¤: portrait-primary
, portrait-secondary
, landscape-primary
, landscape-secondary
, portrait
, landscape
(ê°ê°ì ê°ë¤ì ëí´ ì¢ ë ìë ¤ë©´ lockOrientation
를 ë³´ë¼).
screen.lockOrientation("landscape");
ì°¸ê³ : íë©´ ì ê¸ì ì¹ ì´í리ì¼ì´ì
ì ë°ë¼ ë¤ë¥´ë¤. ì´íë ì¼ì´ì
Aì´ ê°ë¡ëª¨ëë¡ ì 겨 ìê³ ì´íë ì¼ì´ì
Bê° ì¸ë¡ëª¨ëë¡ ì 겨 ìì ë, ì´í리ì¼ì´ì
ì A ìì B ë¡ ëë B ìì A ë¡ ì ííë©´ orientationchange
를 í¸ì¶íì§ ìëë¤. ìëíë©´ ê° ì´í리ì¼ì´ì
ì ê°ìì ë°©í¥ì ì ì§ í기 ë문ì´ë¤.ê·¸ë¬ë, ë§ì½ ì ê¸ì구를 ë§ì¡±í기 ìí´ ë°©í¥ì´ ë°ëì´ì¼íë¤ë©´ íë©´ì ê¸ì orientationchange
ì´ë²¤í¸ë¥¼ í¸ì¶ í ì ìë¤.
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4