表单元格中的(链接)按钮修复(但单击时链接不起作用。)
如何移动另一个'移动' div,当悬停按钮?
代码:
HTML
<table cellpadding="0" cellspacing="0" border="0" width='650' height='320' style="border: 1px solid #000; position: absolute; top: 300px;">
<tr>
<th>
<div class="Fly" style="position: absolute; left: 300px; top: -300px;">
<div id="Superman"></div>
</div>
<div class="button" style="position: absolute; left: 80px; top: 60px;">
<a href="https://stackoverflow.com/questions/25909457/moving-div-moving-whole-page"></a>
</div>
</th>
</tr>
</table>
CSS
#Superman {
background: url(http://www.comixoasis.com/v/vspfiles/templates/runner/images/homepage/Superman.png) no-repeat;
width:250px;
height:300px;
background-size: 90%;
transition: 3s ease;
}
#Superman:hover {
background: url(http://www.mc-villalobos.com/sources/superman.png) no-repeat;
background-size: 100%;
transform: translate(0, 350px);
/*move-down*/
}
.button {
background: url(http://iconbug.com/data/26/256/a2ccff2488d35d8ebc6189ea693cb4a0.png) no-repeat;
width:300px;
height:300px;
}
.button:hover {
background: url(http://1.bp.blogspot.com/__JNFVYfijS4/SX9bD7dk07I/AAAAAAAAAXw/VJCkHGqZFx4/s400/Happy.png) no-repeat;
width:300px;
height:300px;
}
JS
$(document).ready(function () {
function moveDown() {
$('.Fly').animate({
'marginTop': "+=100px"
}, 1000, moveUp)
}
function moveUp() {
$('.Fly').animate({
'marginTop': "-=100px"
}, 1000, moveDown)
}
moveUp();
});
答案 0 :(得分:0)
您的a
元素为空:
<div class="button" style="position: absolute; left: 80px; top: 60px;">
<a href="https://stackoverflow.com/questions/25909457/moving-div-moving-whole-page">
</a>
</div>
将div
移到其中,它应该有效:
<a href="https://stackoverflow.com/questions/25909457/moving-div-moving-whole-page">
<div class="button" style="position: absolute; left: 80px; top: 60px;">
</div>
</a>