onmouseover
을 사용하여 divs를 올리면 div를 확대하는 무언가를 만들었습니다. 그들은 onmouseout
을 사용하여 정상 크기로 축소합니다. 그러나 어떤 이유에서 div가 밀려 내려와 있습니다. 이로 인해 div 중 하나가 글리치 시작합니다. div가 아래로 밀리는 것을 어떻게 막을 수 있습니까? 그렇지만 div가 확대되고 더 작아 지도록하려면 어떻게해야합니까? 업데이트 다른 코드와 함께 사용하면 다시 발생합니다. https://jsfiddle.net/pc65ve7b/확대 후 요소 푸시
누군가 나를 도와 줄 수 있습니까?
function enlarge(a, b, c, d) {
\t a.style.height = "375px";
\t b.style.height = "0px";
\t c.style.height = "0px";
\t d.style.height = "0px";
\t };
\t function shrink(a, b, c, d) {
\t a.style.height = "125px";
\t b.style.height = "125px";
\t c.style.height = "125px";
\t d.style.height = "125px";
\t };
.thing {
height: 125px;
width: 250px;
z-index: 10;
position: relative;
border: 5px solid brown;
}
.aside {
border: 5px solid black;
overflow:hidden;
}
<aside class="aside">
<div id="c1"></div>
<div class="thing" style="background-color: blue;" id="c2" onmouseover="enlarge(this, document.getElementById('c1'), document.getElementById('c3'), document.getElementById('c4'))" onmouseout="shrink(this, document.getElementById('c1'), document.getElementById('c3'), document.getElementById('c4'))"><h1>hello</h1></div>
<div class="thing" style="background-color: orange;" id="c3" onmouseover="enlarge(this, document.getElementById('c1'), document.getElementById('c2'), document.getElementById('c4'))" onmouseout="shrink(this, document.getElementById('c1'), document.getElementById('c2'), document.getElementById('c4'))"><h1>hello</h1></div>
<div class="thing" style="background-color: pink" id="c4" onmouseover="enlarge(this, document.getElementById('c1'), document.getElementById('c2'), document.getElementById('c3'))" onmouseout="shrink(this, document.getElementById('c1'), document.getElementById('c2'), document.getElementById('c3'))"><h1>hello</h1></div>
</aside>
정말이 JavaScript가 필요하십니까? 그냥 CSS를 사용할 수 없습니까? – thepio
이것이 문제를 해결합니까? https://jsfiddle.net/0vmr2c90/ –
아니요 옆으로 요소를 확대하여 – morgan