°³Ã¼µéÀÇ ½×ÀÎ(stack) ¼ø¼¸¦ ¹ÝȯÇϰųª ¼³Á¤ÇÑ´Ù.
NS: event.zIndex|=indexVal]
auto | µðÆúÆ®À̸ç, °³Ã¼µéÀÌ HTML ¹®¼ÀÇ ¿øº»¿¡ ³ªÅ¸³ª´Â ¼ø¼´ë·Î ½×ÀÌ°í À§¿¡¼ºÎÅÍ Â÷·Ê·Î ¾Æ·¡ ±ò¸°´Ù. |
(¼ø¼) | °³Ã¼µéÀÇ ½×ÀÎ(stack) ¼ø¼¸¦ ³ªÅ¸³»´Â Á¤¼ö°ªÀÌ´Ù. |
0 ÀÌ»óÀÇ Á¤¼ö°ªÀ¸·Î ³·Àº ¼öÄ¡ºÎÅÍ ½ºÅÂÅ·µÇ¾î, ³ôÀº ¼öÄ¡ÀÇ °³Ã¼°¡ À§¿¡ ³ªÅ¸³´Ù.
ÀÌ ¼Ó¼ºÀº currentStyle¿¡¼´Â ÀбâÀü¿ëÀÌ°í, ±×¿ÜÀÇ °³Ã¼¿¡¼´Â Àбâ/¾²±âÀ̸ç, µðÆúÆ®°ªÀº autoÀÌ´Ù.
CSS(Cascading Style Sheets) ¾ÖÆ®¸®ºäÆ®´Â »ó¼ÓµÇÁö ¾Ê´Â´Ù.
¾ç¼ö z-index °ªÀº ³·Àº°ª ȤÀº À½¼öz-index¸¦ °®´Â °³Ã¼º¸´Ù À§(above)¿¡ ³ªÅ¸³´Ù. µÎ °³Ã¼°¡ °°Àº z-index °ªÀ» °¡Áö¸é ¿øº» ¹®¼¿¡ ³ªÅ¸³ª´Â ¼ø¼´ë·Î ½ºÅÂÅ·µÈ´Ù. ¾ç¼ö z-index °ªÀ» °®´Â °³Ã¼´Â z-index °ªÀÌ ¼³Á¤µÇÁö ¾Ê´Â °³Ã¼ÀÇ À§¿¡ ½ºÅÂÅ·µÇ°í, À½¼ö °ªÀ» °®´Â °³Ã¼Àº ¼³Á¤ÇÏÁö ¾ÊÀº °³Ã¼ÀÇ ¾Æ·¡ ½ºÅÂÅ·µÈ´Ù. ÆĶó¸ÞÅ͸¦ null·Î ¼³Á¤ÇÏ¸é ±× ¾ÖÆ®¸®ºäÆ®°¡ Á¦°ÅµÈ´Ù.
zIndex ¼Ó¼ºÀº position ¼Ó¼ºÀÌ relative³ª absolute·Î ¼³Á¤µÈ °æ¿ì¿¡¸¸ Àû¿ëµÈ´Ù.
ÀÌ ¼Ó¼ºÀº select °³Ã¼¿Í °°Àº À©µµ¿ì Á¦¾î¿¡´Â Àû¿ëµÇÁö ¾Ê´Â´Ù.
ÀÌÀü ¹öÀü¿¡¼´Â iFrame °³Ã¼´Â À©µµ¿¡ ÀÖ°í ¸ðµç À©µµ¿ì Á¦¾î´Â zIndex ¼Ó¼ºÀ» ¹«½ÃÇß¾úÀ¸³ª, IE5.5¿¡¼ iFrame °³Ã¼´Â À©µµ¿ì°¡ ¾ø°í zIndex ¼Ó¼ºÀ» Áö¿øÇÑ´Ù. zIndex ¼Ó¼ºÀ» Áö¿øÇÏÁö ¾Ê´Â ÀÌÀü ¹öÀü¿¡¼ ÀÛ¼ºÇÑ À¥ÆäÀÌÁö¸¦ À¯ÁöÇÏ·Á¸é, ƯÈ÷ select °³Ã¼¿Í °°Àº À©µµ¿ì Á¦¾î À§¿¡ ½ºÅÂÅ·µÈ iFrame °³Ã¼¸¦ Æ÷ÇÔÇÏ°í ÀÖÀ¸¸é, ¹®¼¸¦ ´Ù½Ã µðÀÚÀÎÇØ¾ß ÇÒ °ÍÀÌ´Ù. ÀÌ°æ¿ì visibility ¾ÖÆ®¸®ºäÆ®·Î ¿øÇÏ´Â iFrame °³Ã¼¸¦ °ãÄ¡´Â À©µµ¿ìÀÇ Á¦¾î¸¦ °¨Ãâ ¼ö ÀÖ´Ù. ¶ÇÇÑ iFrame °³Ã¼°¡ ±× °³Ã¼¿¡ °ãÄ¡Áö ¾Êµµ·Ï À©µµ¿ì Á¦¾î¸¦ position ¼Ó¼ºÀ¸·Î À§Ä¡½Ãų ¼ö ÀÖ´Ù.
¿¤·¹¸àÆ®°¡ º¸ÀÌÁö ¾Ê´Â °ÍÀ̶óµµ, ¸¶¿ì½º¿Í °°Àº ÀÔ·Â Æ÷ÀÎÆà ÀåÄ¡·Î °ãÃÄÁø ¿¤·¹¸àÆ®¸¦ Åë°úÇÒ ¼ö ¾ø´Ù. ´ÙÀ½ÀÇ °æ¿ì°¡ ¾Æ´Ï¸é À½¼ö z-index ¼Ó¼º°ª¿¡¼µµ ¸¶Âù°¡ÁöÀÌ´Ù.
layer °³Ã¼¿¡ Àû¿ëµÇ°í, above ¶Ç´Â below ¼Ó¼ºÀ» ±¸ÇöÇϱâ À§Çؼ ´Ù¸¥ ÆĶó¸ÞÅ͸¦ ÇÊ¿ä·Î Çϴµ¥ ÀÌ°ÍÀÌ zIndex ÀÌ´Ù.
ÀÌ zIndex ¼Ó¼º°ªÀÌ Å¬¼ö·Ï ¾Æ·§ÂÊ¿¡ ±ò¸®°í, ±× °ªÀ» Á¶Á¤ÇϹǷμ ´Ü¼øÈ÷ ¼öÁ÷, ¼öÆò À§Ä¡ Á¶Á¤ »Ó¾Æ´Ï¶ó screen¿¡¼ ÀÃþÀ¸·Î ȤÀº ¾Æ·¡ÃþÀ¸·Î ź·ÂÀûÀ¸·Î ¿òÁ÷ÀÌ°Ô ÇÒ ¼ö ÀÖ´Ù.
°³Ã¼ | script | CSS | IE ¹öÀü |
---|
ÀÌ ¼Ó¼ºÀº CSS2(Cascading Style Sheets Level 2)¿¡ Á¤ÀǵǾú´Ù.
z-index ¾ÖÆ®¸®ºäÆ®¸¦ ¼³Á¤ÇÏ°í zIndex ¼Ó¼º°ªÀ» º¯°æÇÏ¿© º¸ÀÌ´Â ¼ø¼¸¦ ¹Ù²Û´Ù.
<SCRIPT> function ShowAll(){ if (divObj.style.zIndex==1) divObj.style.zIndex=5; else divObj.style.zIndex=1; str='imgObj.style.zIndex='+imgObj.style.zIndex+'<BR>'; str+='divObj.style.zIndex='+divObj.style.zIndex+'<BR>'; showA.innerHTML=str; } </SCRIPT> <IMG id="imgObj" src="../../gif/rfexample.gif" style="position:relative;top:10;left:0;z-index:3" height=25> <DIV id="divObj" style="position:relative;top:-20;left:10;padding:5;color:blue; background-color:ffa;font-weight:bold;border:solid 1 blue;z-index:1">DIV Áö¿ª</DIV> <BUTTON onclick="ShowAll()">divObj.style.zIndex</BUTTON> <DIV id=showA>°á°ú Ç¥½Ãâ</DIV>
À̹ÌÁö À§¸¦ Ŭ¸¯Çغ¸¶ó.
<SCRIPT> function showzIndex(){ str='img1.style.zIndex='+img1.style.zIndex+'<BR>'; str+='img2.style.zIndex='+img2.style.zIndex+'<BR>'; showB.innerHTML=str; } </SCRIPT> <IMG id="img1" src="../../gif/rfexample.gif" height="24" style="position:relative;top:0;left:5;" onclick="img1.style.zIndex=1; img2.style.zIndex=2;showzIndex()"> <IMG id="img2" src="../../gif/rfstyle.gif" height="24" style="position:relative;top:0;left:-50;" onclick="img1.style.zIndex=2; img2.style.zIndex=1;showzIndex()"> <DIV id=showB>°á°ú Ç¥½Ãâ</DIV>
°³Ã¼¸¦ Ŭ¸¯ÇØ º¸¶ó.
¿¹Á¦´Â µÎ°³ÀÇ DIV °³Ã¼¸¦ »ý¼ºÇÏ°í, zIndex ¼Ó¼ºÀ¸·Î ¾Æ·¡, ÀÃþÀ¸·Î ³ªÅ¸³ª°Ô µÈ´Ù.<DIV style="border:dotted 1 green;padding-bottom:30" onclick="change()"> <DIV id="obj1" style="position:relative;zIndex:1;border:solid 1 blue;background:lightgreen;width:150;height:50;top:30;left:40">°³Ã¼ 1</DIV> <DIV id="obj2" style="position:relative;zIndex:5;border:solid 1 red;background:lightblue;width:160;height:30;top:10;left:10">°³Ã¼ 2</DIV> </DIV> <SCRIPT> function change(){ if (obj1.style.zIndex==1) obj1.style.zIndex=5; else obj1.style.zIndex=1; if (obj2.style.zIndex==5) obj2.style.zIndex=1; else obj2.style.zIndex=5; } </SCRIPT>
<layer name="layer1" zIndex=1 bgcolor="lightgreen" top="50" left="80" width="150" height="50">·¹À̾î 1</layer> <layer name="layer2" zIndex=5 bgcolor="lightblue" top="20" left="50" width="75" height="100">·¹À̾î 2</layer> <SCRIPT> document.weite(document.layer1.zIndex+' '+document.blowLayer.zIndex); document.layer1.zIndex=5; document.layer2.zIndex=1; document.weite(document.layer1.zIndex+' '+document.blowLayer.zIndex); </SCRIPT>