I am trying to right align the panel so it works with bootstrap, and so it works for all screen sizes. The left align works for all screen sizes. How can I make this work for the right align?
Javascript
$('#opener').on('click', function() {
var panel = $('#slide-panel');
if (panel.hasClass("visible")) {
panel.removeClass('visible').animate({'margin-left':'100%'});
} else {
panel.addClass('visible').animate({'margin-left':'90%'});
}
return false;
});
CSS
#slide-panel {
width:300px;
height:300px;
padding:10px;
background:#eee;
margin-left:100%;
}
#opener {
float:left;
margin:-10px -50px 0px -50px;
border-radius:0;
}
HTML
<div id="slide-panel">
<a href="#" class="btn btn-danger" id="opener"><i class="glyphicon glyphicon-align-justify"></i></a>
Panel Content
</div>
Making a side panel can be done with the following steps:
position: absolute
or position: fixed
top: 0
and right: -N
where N is the width of the panel right
to 0
overflow-x: hidden
on the body and html This only works if the width of the side panel is constant.
Here's the Fiddle: http://jsfiddle.net/acbabis/ZnNHk/
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.