1
我對Javascript,CSS和HTML的整個部分有點新鮮。將div附加到響應的父div上
我想一個div附加到父div的底部和中心。 父級div中有一個響應式背景圖片。我的發條箭頭貼在底部,在垂直方向響應,不是水平的,也不居中。
請問任何一種靈魂,請解釋如何解決這個問題,或告訴我,如果我開始錯了!
在此先感謝。
這裏是我的代碼:
HTML:
<div class="content-1">
<div id="to-first">
<i class="fa fa-angle-down"></i>
</div>
</div>
CSS:
.content-1 {
position: relative;
}
#to-first {
position: absolute;
margin-right: 50%;
bottom: 10;
color: #000;
font-size: 50px;
text-align: center;
cursor: pointer;
display: none;
}
的Javascript:
var main = function() {
$(document).ready(function() {
$('#to-first').show();
});
$('#to-first').click(function() {
$('body,html').animate({scrollTop: $("footer").offset().top},"slow");
});
};
$(document).ready(main);
這裏是一個的jsfiddle:
https://jsfiddle.net/804jeg82/330/
感謝的人,就像一個魅力! – tobiasvestlund