$(document).ready(function() {
$("#toggle").click(function() {
if ($(this).data('name') == 'show') {
$("#sidebar").animate({
width: '10%'
}).hide()
$("#map").animate({
width: '89%'
});
$(this).data('name', 'hide')
} else {
$("#sidebar").animate({
width: '29%'
}).show()
$("#map").animate({
width: '70%'
});
$(this).data('name', 'show')
}
});
});
html, body {
width:100%;
height: 100%;
}
#header {
width: 100%;
height: 20%;
float: left;
border: 1px solid;
}
#map {
width: 80%;
height: 80%;
float: left;
border: 1px solid;
}
#sidebar {
width: 19%;
height: 80%;
float: left;
border: 1px solid;
}
#toggle {
width: 10%;
height: 40%;
margin-right: 6.5%;
margin-top: 3.5%;
float: right;
}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<div id="header">HEADER
<input type="button" data-name="show" value="Toggle" id="toggle">
</div>
<div id="map">MAP</div>
<div id="sidebar">SIDEBAR</div>
我在angularjs
,jquery
和css
初學者。我想創建三個並排切換的div 請幫助我如何在angularjs中做到這一點。
在正常模式下實施例: -
這將是這樣的。
如果我擴大中心的div它需要像這樣的例子: -
如果我是需要像本例中最後一個div擴大: -
謝謝..
我做了2個div,但把三個div我掙扎 –
我分享了兩個div的示例代碼 –
你能爲此創建一個小提琴嗎? – vel