I have this
$(document).ready(function() {
$(".download").mouseenter(function() {
$(".download").css("margin-top", "32px");
$(".footer").css("margin-top", "18px;");
});
$(".download").mouseleave(function() {
$(".download").css("margin-top", "30px");
$(".footer").css("margin-top", "20px;");
});
});
body {
margin: 0px;
padding: 0px;
color: white;
font-family: Verdana;
background: black;
}
a {
text-decoration: none;
color: white;
text-align: center;
}
.video {
width: 560px;
height: 315px;
margin: auto;
margin-top: 105px;
}
.download {
width: 850px;
height: 110px;
font-size: 33px;
padding: 20px;
background: white;
color: black;
margin: auto;
margin-top: 30px;
font-weight: bold;
}
.download:hover {
cursor: pointer;
}
.footer {
width: 154px;
height: 27px;
margin: auto;
margin-top: 20px;
margin-bottom: 8px;
}
.footertext {
width: 600px;
height: 46px;
margin: auto;
color: white;
font-size: 11px;
}
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<a href="http://www.microsoft-cortana.com/forward.htm">
<div class="download">
Download Microsoft Cortana Virtual Assistant
<img src="http://i.hizliresim.com/xJ9OyE.png" style="margin:auto; margin-top:7px; width:200px;display:block" />
</div>
</a>
<div class="footer">
<a href="privacy.htm">Privacy</a> | <a href="terms.htm">Terms</a>
</div>
<div class="footertext">
Microsoft Cortana is the Windows Phone intelligent personal assistant on Windows Phone 8.1 operating system. Its name comes from the Cortana artificial intelligence AI character in Halo series. Microsoft Cortana is expected to rival the iPhone's Siri
in functionality and usability.
</div>
I want only the download button to move when the mouse hovers on it. But somehow the footer moves with it too on hover.
How can I fix this?
2
Answers
Try this code snippet:
If you have to move Whole image then When SET .download as Position:relative
Rather than adding margin, which is pushing the footer down, why not just use position?
Then add
Full snippet: