我的HTML
<div class="container-fluid">
<div class="row">
<div class="col-md-3">
<div class="left-top"><a>Aanmelden</a></div>
<div class="left-bottom"><a>Inloggen</a></div>
</div>
<div class="col-md-6">
<img src="http://placehold.it/350x310" alt="" class="welcome-image"/>
</div>
<div class="col-md-3">
<div class="right-top"></div>
<div class="right-bottom"></div>
</div>
</div>
</div>
<script>
$(document).ready(function () {
$('[class^=left], [class^=right]').on('click', function () {
$(this).addClass('fullscreen');
});
});
</script>
每当点击一个按钮时,我都希望父方块全屏, 问题是:
width:100%
时,需要.col-md-3
.col-md-3
类时
整页都爆炸了。有没有办法实现全屏,同时保持其余部分完好无损?
谢谢, G3
答案 0 :(得分:3)
Bootply :http://www.bootply.com/DfNnqvTcRL
JS :
$(document).ready(function () {
$('[class^=left], [class^=right]').on('click', function () {
$(this).parent().toggleClass('parent-fullscreen');
$(this).toggleClass('fullscreen');
});
});
<强>的CSS 强>:
.parent-fullscreen{
position:absolute;
z-index:2000;
width:100%;
height:100%;
}
.fullscreen {
width: 100%;
height: 100%;
position:absolute;
top:0px;
}