jQuery: slimScrollbar hides elements
Ad
I'm trying to use: http://rocha.la/jQuery-slimScroll/ (Scroll down to see typical examples)
This is my codepen: http://codepen.io/jzhang172/pen/admvRR
$(function(){
$('#container').slimScroll({
height: '250px'
});
});
@import url("http://fonts.googleapis.com/css?family=Ubuntu+Condensed");
*{
-webkit-box-sizing: border-box;
-moz-box-sizing: border-box;
box-sizing: border-box;
}
html{
background: url('img/congruent_pentagon.png');
}
body{
margin:0px;
}
#wrapper{
height: auto;
width: 100%;
max-width: 300px;
margin-left: auto;
margin-right: auto;
background-color: #fff;
margin-top: 2em;
margin-bottom: 2em;
height: 100%;
font: 25px/24px normal 'Ubuntu Condensed', sans-serif;
background: transparent;
}
a{
text-decoration: none;
}
.social{
display: inline-block;
position: relative;
width: 100%;
padding: 16px;
margin-bottom: 16px;
margin-right: 16px;
background-color: rgba(231, 231, 231, 0.6);
box-shadow: 8px 8px 0 0px rgba(0, 0, 0, 0.25);
}
nav{
padding-top: 8px;
padding-left: 8px;
padding-right: 8px;
}
nav ul{
margin: 0;
padding: 0;
list-style: none;
}
nav ul li{
display: inline;
}
nav ul li a:hover{
opacity: 0.7;
}
nav ul li a.email{
border-left: 50px solid #c9182c;
color: #c9182c;
}
nav ul li a.twitter{
border-left: 50px solid #00a0d1;
color: #00a0d1;
}
nav ul li a.facebook{
border-left: 50px solid #365998;
color: #365998;
}
nav ul li a.github{
border-left: 50px solid #4183c4;
color: #4183c4;
}
nav ul li a.google{
border-left: 50px solid #db4a39;
color: #db4a39;
}
nav ul li a.instagram{
border-left: 50px solid #634d40;
color: #634d40;
}
nav ul li a.tumblr{
border-left: 50px solid #34526f;
color: #34526f;
}
nav ul li a.scriptogram{
border-left: 50px solid #0088cc;
color: #0088cc;
}
nav ul li a.linkedin{
border-left: 50px solid #0e76a8;
color: #0e76a8;
}
.container{
width:100%;
text-align:center;
background:rgba(0, 0, 0, 0.07);
padding-top:20px;
padding-bottom: 20px;
}
.container h1{
font-family: 'EB Garamond', serif;
font-size:55px;
width:500px;
margin:0 auto;
border-top:1px solid black;
border-bottom:1px solid black;
}
.container span{
width:100px;
height:300px;;
}
h2{
font-family: 'Lora', serif;
text-align:center;
font-size:25px;f
font-weight:normal;
}
#headline{
font-size:10px;
}
span img{
height: 70px;
position: relative;
top: 10px;
left: -20px;
}
.announcements{
width:500px;
margin:0 auto;
height:500px;
min-height:500px;
background:rgba(152, 170, 179, 0.44);
border:1px solid #B1F6CB;
border-radius:20px;
padding-top:10px;
}
.announcements h2{
font-size:20px;
font-family: 'Josefin Slab', serif;
font-weight:800;
float:left;
background:#0B437D;
width:100%;
color:#F9F9F9;;
}
span.date{
font-family: 'Slabo 27px', serif;
}
span.important{
font-size:20px;
font-weight:800px;
color:red;
}
.sectionwrapper{
width:100%;
padding:50px;
margin:0 auto;
height:390px;
overflow:auto;
padding-top:0px;
position:relative;
}
span.new-policy{
background:#2184BF;
color:#F3F3F3;
border:1px solid black;
font-size:14px;
font-family: 'Lato', sans-serif;
}
span.description{
font-family: 'Lato', sans-serif;
font-size:14px;
}
.section a{
color:black;
}
.section a:hover{
color:#23A6D0;
transition:.1s ease;
}
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.0.0-alpha1/jquery.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jQuery-slimScroll/1.3.7/jquery.slimscroll.js"></script>
<link href='https://fonts.googleapis.com/css?family=Libre+Baskerville|Lora|Maven+Pro|Merriweather|EB+Garamond|Open+Sans|Lato|Slabo+27px|Josefin+Slab' rel='stylesheet' type='text/css'>
<div class="announcements">
<h2>Announcements</h2>
<div class="sectionwrapper" id="container">
<div class="section">
<span class="date">12/20/15</span><br><span class="important">!</span>
<span class="new-policy"> New Policy </span>
<a target="_blank" rel="nofollow noreferrer" target="_blank" rel="nofollow noreferrer" href="#"><span class="description"> Paid Week Time Off each Month <br>Every month, choose any week for paid time off for that entire week. Spend time with your loved ones. Go travel som...</span></a>
</div>
<hr>
<div class="section">
<span class="date">12/27/15</span><br><span class="important">!</span>
<span class="new-policy"> New Policy </span>
<a target="_blank" rel="nofollow noreferrer" target="_blank" rel="nofollow noreferrer" href="#"><span class="description"> Paid Week Time Off each Month <br>Every month, choose any week for paid time off for that entire week. Spend time with your loved ones. Go travel som...</span></a>
</div>
<hr>
<div class="section">
<span class="date">12/20/15</span><br><span class="important">!</span>
<span class="new-policy"> New Policy </span>
<a target="_blank" rel="nofollow noreferrer" target="_blank" rel="nofollow noreferrer" href="#"><span class="description"> Paid Week Time Off each Month <br>Every month, choose any week for paid time off for that entire week. Spend time with your loved ones. Go travel som...</span></a>
</div>
<hr>
<div class="section">
<span class="date">12/20/15</span><br><span class="important">!</span>
<span class="new-policy"> New Policy </span>
<a target="_blank" rel="nofollow noreferrer" target="_blank" rel="nofollow noreferrer" href="#"><span class="description"> Paid Week Time Off each Month <br>Every month, choose any week for paid time off for that entire week. Spend time with your loved ones. Go travel som...</span></a>
</div>
<hr>
<div class="section">
<span class="date">12/20/15</span><br><span class="important">!</span>
<span class="new-policy"> New Policy </span>
<a target="_blank" rel="nofollow noreferrer" target="_blank" rel="nofollow noreferrer" href="#"><span class="description"> Paid Week Time Off each Month <br>Every month, choose any week for paid time off for that entire week. Spend time with your loved ones. Go travel som...</span></a>
</div>
<hr>
</div>
</div>
If you remove the JS, it shows everything in the box. Why is it doing that? Why isn't the Jquery plugin working?
Ad
Answer
Ad
The ccs float: left
in the .announcements h2
seems to be triggering the problem. I removed that and it worked.
$(function(){
$('#container').slimScroll({
height: '250px'
});
});
@import url("http://fonts.googleapis.com/css?family=Ubuntu+Condensed");
*{
-webkit-box-sizing: border-box;
-moz-box-sizing: border-box;
box-sizing: border-box;
}
html{
background: url('img/congruent_pentagon.png');
}
body{
margin:0px;
}
#wrapper{
height: auto;
width: 100%;
max-width: 300px;
margin-left: auto;
margin-right: auto;
background-color: #fff;
margin-top: 2em;
margin-bottom: 2em;
height: 100%;
font: 25px/24px normal 'Ubuntu Condensed', sans-serif;
background: transparent;
}
a{
text-decoration: none;
}
.social{
display: inline-block;
position: relative;
width: 100%;
padding: 16px;
margin-bottom: 16px;
margin-right: 16px;
background-color: rgba(231, 231, 231, 0.6);
box-shadow: 8px 8px 0 0px rgba(0, 0, 0, 0.25);
}
nav{
padding-top: 8px;
padding-left: 8px;
padding-right: 8px;
}
nav ul{
margin: 0;
padding: 0;
list-style: none;
}
nav ul li{
display: inline;
}
nav ul li a:hover{
opacity: 0.7;
}
nav ul li a.email{
border-left: 50px solid #c9182c;
color: #c9182c;
}
nav ul li a.twitter{
border-left: 50px solid #00a0d1;
color: #00a0d1;
}
nav ul li a.facebook{
border-left: 50px solid #365998;
color: #365998;
}
nav ul li a.github{
border-left: 50px solid #4183c4;
color: #4183c4;
}
nav ul li a.google{
border-left: 50px solid #db4a39;
color: #db4a39;
}
nav ul li a.instagram{
border-left: 50px solid #634d40;
color: #634d40;
}
nav ul li a.tumblr{
border-left: 50px solid #34526f;
color: #34526f;
}
nav ul li a.scriptogram{
border-left: 50px solid #0088cc;
color: #0088cc;
}
nav ul li a.linkedin{
border-left: 50px solid #0e76a8;
color: #0e76a8;
}
.container{
width:100%;
text-align:center;
background:rgba(0, 0, 0, 0.07);
padding-top:20px;
padding-bottom: 20px;
}
.container h1{
font-family: 'EB Garamond', serif;
font-size:55px;
width:500px;
margin:0 auto;
border-top:1px solid black;
border-bottom:1px solid black;
}
.container span{
width:100px;
height:300px;;
}
h2{
font-family: 'Lora', serif;
text-align:center;
font-size:25px;f
font-weight:normal;
}
#headline{
font-size:10px;
}
span img{
height: 70px;
position: relative;
top: 10px;
left: -20px;
}
.announcements{
width:500px;
margin:0 auto;
height:500px;
min-height:500px;
background:rgba(152, 170, 179, 0.44);
border:1px solid #B1F6CB;
border-radius:20px;
padding-top:10px;
}
.announcements h2{
font-size:20px;
font-family: 'Josefin Slab', serif;
font-weight:800;
/*float:left;*/
background:#0B437D;
width:100%;
color:#F9F9F9;;
}
span.date{
font-family: 'Slabo 27px', serif;
}
span.important{
font-size:20px;
font-weight:800px;
color:red;
}
.sectionwrapper{
width:100%;
padding:50px;
margin:0 auto;
height:390px;
overflow:auto;
padding-top:0px;
position:relative;
}
span.new-policy{
background:#2184BF;
color:#F3F3F3;
border:1px solid black;
font-size:14px;
font-family: 'Lato', sans-serif;
}
span.description{
font-family: 'Lato', sans-serif;
font-size:14px;
}
.section a{
color:black;
}
.section a:hover{
color:#23A6D0;
transition:.1s ease;
}
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.0.0-alpha1/jquery.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jQuery-slimScroll/1.3.7/jquery.slimscroll.js"></script>
<link rel="stylesheet" target="_blank" rel="nofollow noreferrer" target="_blank" rel="nofollow noreferrer" href="styles.css">
<link href='https://fonts.googleapis.com/css?family=Libre+Baskerville|Lora|Maven+Pro|Merriweather|EB+Garamond|Open+Sans|Lato|Slabo+27px|Josefin+Slab' rel='stylesheet' type='text/css'>
<link rel='shortcut icon' href='img/favicon.ico' type='img/favicon.ico'>
<div class="announcements">
<h2>Announcements</h2>
<div class="sectionwrapper" id="container">
<div class="section">
<span class="date">12/20/15</span><br><span class="important">!</span>
<span class="new-policy"> New Policy </span>
<a target="_blank" rel="nofollow noreferrer" target="_blank" rel="nofollow noreferrer" href="#"><span class="description"> Paid Week Time Off each Month <br>Every month, choose any week for paid time off for that entire week. Spend time with your loved ones. Go travel som...</span></a>
</div>
<hr>
<div class="section">
<span class="date">12/27/15</span><br><span class="important">!</span>
<span class="new-policy"> New Policy </span>
<a target="_blank" rel="nofollow noreferrer" target="_blank" rel="nofollow noreferrer" href="#"><span class="description"> Paid Week Time Off each Month <br>Every month, choose any week for paid time off for that entire week. Spend time with your loved ones. Go travel som...</span></a>
</div>
<hr>
<div class="section">
<span class="date">12/20/15</span><br><span class="important">!</span>
<span class="new-policy"> New Policy </span>
<a target="_blank" rel="nofollow noreferrer" target="_blank" rel="nofollow noreferrer" href="#"><span class="description"> Paid Week Time Off each Month <br>Every month, choose any week for paid time off for that entire week. Spend time with your loved ones. Go travel som...</span></a>
</div>
<hr>
<div class="section">
<span class="date">12/20/15</span><br><span class="important">!</span>
<span class="new-policy"> New Policy </span>
<a target="_blank" rel="nofollow noreferrer" target="_blank" rel="nofollow noreferrer" href="#"><span class="description"> Paid Week Time Off each Month <br>Every month, choose any week for paid time off for that entire week. Spend time with your loved ones. Go travel som...</span></a>
</div>
<hr>
<div class="section">
<span class="date">12/20/15</span><br><span class="important">!</span>
<span class="new-policy"> New Policy </span>
<a target="_blank" rel="nofollow noreferrer" target="_blank" rel="nofollow noreferrer" href="#"><span class="description"> Paid Week Time Off each Month <br>Every month, choose any week for paid time off for that entire week. Spend time with your loved ones. Go travel som...</span></a>
</div>
<hr>
</div>
</div>
</div>
Ad
source: stackoverflow.com
Related Questions
Ad
- → How to update data attribute on Ajax complete
- → October CMS - Radio Button Ajax Click Twice in a Row Causes Content to disappear
- → Octobercms Component Unique id (Twig & Javascript)
- → Passing a JS var from AJAX response to Twig
- → Laravel {!! Form::open() !!} doesn't work within AngularJS
- → DropzoneJS & Laravel - Output form validation errors
- → Import statement and Babel
- → Uncaught TypeError: Cannot read property '__SECRET_DOM_DO_NOT_USE_OR_YOU_WILL_BE_FIRED' of undefined
- → React-router: Passing props to children
- → ListView.DataSource looping data for React Native
- → Can't test submit handler in React component
- → React + Flux - How to avoid global variable
- → Webpack, React & Babel, not rendering DOM
Ad