Bootstrap affixed sidebar being overlapped by main content in Angular app - css

I have an angular app with some nested views that might be causing the problem but I just can't pin it down. Whenever position: fixed is added to the sidebar the main content moves over and overlaps it. You can see whats happening at this page and here is some of my code, let me know if more is needed.
*Update
I tried combining the app.products and app.products.juice states and I still have the issue so I'm thinking it's my CSS and not the nested states
Controller
.controller('ProductsCtrl', function() {
$('#affix').affix({
offset: {
top: function () {
var $el = $('#productsBg');
return (this.top = $el.position().top + $el.outerHeight(true));
},
bottom: 50
}
})
})
SCSS
.ui-view-container {
position: relative;
}
.panelNav {
margin: 5% 0 0 5%;
&.affix {
top: 0;
}
}
State app
<header>
...
</header>
<div class="ui-view-container">
<main ui-view="mainContent"></main>
</div>
<footer id="footer">
</footer>
State app.products
<div class="container-fluid">
<div id=affix class="col-md-2 panelNav">
<div class="panel panel-primary">
<div class="panel-heading">Products Menu</div>
<div class="list-group">
<a class="list-group-item" ui-sref="app.products.juice">Juice</a>
<a class="list-group-item" ui-sref="app.products.mods">Mods</a>
<a class="list-group-item" ui-sref="app.products.batteries">Batteries</a>
<a class="list-group-item" ui-sref="app.products.tanks">Tanks</a>
</div>
</div>
</div>
<section class="col-md-9">
<ui-view name="productsContent"></ui-view>
</section>
</div>
State app.products.juice
<div>
<p> 10 paragraphs of filler text</p>
</div>

Update Jun 2017: As noted by #AdamPlocher my original suggestion below didn't clearly answer the question, here's a better illustration:
https://codepen.io/panchroma/pen/ZyOOdM
====
Original answer
See if this helps you :http://codepen.io/panchroma/pen/EKGXGj
When you apply position: fixed; to the sidebar, it takes it out of flow, and the main content moves to the left, into the space which had been occupied by the sidebar.
One option which I think should work for you is to leave the sidebar unchanged, and instead create a new child div and apply position:fixed; to this child div. (see below)
When you do this, the sidebar stays in-flow, doesn't collapse and the main content doesn't move left.
Hope this helps!
=== CSS ===
.panelNav{
position:absolute;
}
=== Original HTML ===
<div class="container-fluid original">
<div class="col-md-2 sidebar panelNav">sidebar</div>
<div class="col-md-9 main-content">main content</div>
</div>
=== Updated HTML ===
<div class="container-fluid">
<div class="col-md-2 sidebar">
<div class="panelNav">sidebar</div>
</div>
<div class="col-md-9 main-content">main content</div>
</div>

Related

Bootstrap (on Laravel) - Header dropdown becomes transparent on one page

I seem to have an issue with one of my pages I'm trying to layout. I implemented FullCalendar and added it to one of my pages/views, I'm now noticing that my header dropdown when it overlays on top of where the calendar begins -- the dropdown isn't opaque/forced overtop of the underlaying content like how it is on all other pages. Attached is the example of what is happening.
Any ideas? If I should be posting my CSS let me know. It's the default for FullCalendar & Bootstrap with no modifications.
Here is the view HTML/classes applied to the content it's not drawing 'over/on top of':
#section('content')
#include('layouts.headers.cards')
<div class="container-fluid mt--7">
<div class="row">
<div class="col">
<div class="card shadow">
<div class="card-header border-0">
<div class="col-14">
<div id='calendar'></div>
</div>
</div>
</div>
</div>
</div>
#include('layouts.footers.auth')
</div>
#endsection
#calendar{
z-index: 999999;
position: relative;
}
<< That should fix it!
Read: https://www.w3schools.com/cssref/pr_pos_z-index.asp

Keep footer at bottom of page when Vue component changes

anyone know how to keep the footer at the bottom of a reactive component when the component view changes? I currently have set the content to 100vh for the height CSS property, which works on first load. However, when I change the state which then changes the view, the footer stays in the same place, while the component's height grows as I add more elements. So then the footer is in the middle of the page again. Here is the component template:
<template>
<div id="app">
<div class="title-bar" data-responsive-toggle="navbar" data-hide-for="medium">
<button class="menu-icon" type="button" data-toggle="navbar"></button>
<div class="title-bar-title">Menu</div>
</div>
<div class="top-bar" id="navbar">
<div class="top-bar-left">
<ul class="menu">
<li class="brand">
NAME
</li>
</ul>
</div>
<div class="top-bar-right">
<ul class="menu" v-if="this.$cookies.get('user')">
<li><router-link class="link align-left" to="/sentences">Home</router-link></li>
<li #click="logout"><a>Logout</a></li>
</ul>
</div>
</div>
<div class="content-wrapper">
<router-view></router-view>
</div>
<!-- WHERE I AM HAVING THE ISSUE -->
<footer>
<p>© 2017</p>
</footer>
</div>
</template>
CSS:
footer {
background-color: #333;
height: 65px;
padding: 20px;
}
footer > p {
margin: 0;
}
Thanks for any ideas of how to solve this problem!
You can use nextTick that allows you to do something after you have changed the data and VueJS has updated the DOM based on your data change
method:{
this.$nextTick(() => {
this.scrollToEnd();
});
scrollToEnd: function () {
var messages = this.$el.querySelector(your component)
messages.scrollTop = messages.scrollHeight
}
}
Please try this methods to keep footer in the bottom in here

html img with 100% width, and clipped to parent element's height, which is not fixed

I have an image, 'img.icon-avatar set within some html: http://jsbin.com/moqagu/5/edit?html,css,output
How can I force the image to be 100% width (as is now), but clipped to the height of it's parent element, so (in the example) it doesn't push the next panel down, and respects or includes the padding?
html:
<div class="row">
<div class="col-xs-3">
<div class="icon-avatar">
<img class="icon-avatar img-rounded" src="http://s3.amazonaws.com/37assets/svn/765-default-avatar.png" alt="avatar"/>
</div>
</div>
<div class="col-xs-9">
<div class="panel panel-primary">
<div class="panel-heading">
<h3 class="panel-title">
Title
</h3>
</div>
<div class="panel-body">
Content
</div>
</div> <!--panel -->
</div>
</div> <!-- row -->
css:
div.icon-avatar {
?
}
img.icon-avatar {
width:100%;
?
}
Note that the parent element's height is not fixed, and will be based on other elements on the page, so I need the parent element to ignore the image when determining its own height.
like that:
div.icon-avatar {
text-align: center
}
img.icon-avatar {
width:auto;
max-height:90px;
}

sass :first-child selector not working

I have a element which is in ng-repeat
<div class="panel panel-default" ng-repeat="candidateInfo in aCandidateDetails">
<div class="panel-heading">
<div class="row">
<div class="col-xs-1">
<a style="cursor:pointer">
{{candidateInfo.name}}</a>
</div>
</div>
<div stop-watch time="xyz" name="candidateInfo.name" time-of-interview="candidateInfo.doi" class="panel-height" ></div>
</div>
I need to increase the height of 1st panel div ;i gave a class="panel-height"
the sass code which i gave is
div .panel-height {
&:first-child {
height: 500px;
}
}
but its not working,no idea where im going wrong
Any help will be appreciated

Bootstrap affix bottom overlay content

I have following css:
#stopBtn{
width : 100%;
bottom: 0px;
}
.affix-bottom{
position: absolute;
}
this is javascript:
$("#stopBtn").affix({
offset: {
bottom: 0
}
});
The affix effect run smooth, but at the bottom it doesn't place below the content but overlap content.
The markup of it looks like:
<div class="row">
<div class="col-lg-12 col-md-12 col-sm-12 col-xs-12">
<!-- <div class="text-center"> -->
<div class="panel-group" id="accordion" role="tablist" aria-multiselectable="true">
</div>
<!-- </div> -->
</div>
</div>
<div class"tex-center" id="stopBtn">
<button class="btn btn-danger btn-mega stopButton">PAUSE</button>
</div>
I solved it, but putting some extra space after the accordion. put in about 4 does the trick

Resources