$(document).on('click', '.addResponse', function(){
$('.response_container').prepend('<div>' + $('.myInput').val() + '</div>');
});
.gradient_overlay {
background: -moz-linear-gradient(top, rgba(255,137,137,0) 0%, rgba(255,48,48,0.5) 50%, rgba(255,50,50,1) 100%); /* FF3.6+ */
background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,rgba(255,137,137,0)), color-stop(50%,rgba(255,48,48,0.5)), color-stop(100%,rgba(255,50,50,1))); /* Chrome,Safari4+ */
background: -webkit-linear-gradient(top, rgba(255,137,137,0) 0%,rgba(255,48,48,0.5) 50%,rgba(255,50,50,1) 100%); /* Chrome10+,Safari5.1+ */
background: -o-linear-gradient(top, rgba(255,137,137,0) 0%,rgba(255,48,48,0.5) 50%,rgba(255,50,50,1) 100%); /* Opera 11.10+ */
background: -ms-linear-gradient(top, rgba(255,137,137,0) 0%,rgba(255,48,48,0.5) 50%,rgba(255,50,50,1) 100%); /* IE10+ */
background: linear-gradient(to bottom, rgba(255,137,137,0) 0%,rgba(255,48,48,0.5) 50%,rgba(255,50,50,1) 100%); /* W3C */
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#00ff8989', endColorstr='#ff3232',GradientType=0); /* IE6-9 */
position: absolute;
width: 100%;
height: 100%;
top: 0;
}
.response_container {
height: 1000px;
}
.input_container {
z-index: 10;
position: relative;
}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<div class="input_container">
<input class="myInput" type="text"/><button class="addResponse">Add Item</button>
</div>
<div class="response_container">
<div class="gradient_overlay"></div>
</div>
- 使用'$( 'logo_container')' HTT p://jsfiddle.net/maio/0ma4na3t/89/ – maioman