Skip to content

Commit

Permalink
6 - Content Overflow Part 2
Browse files Browse the repository at this point in the history
  • Loading branch information
codingforentrepreneurs committed Oct 3, 2017
1 parent ec9b8d3 commit d4b8fed
Showing 1 changed file with 21 additions and 2 deletions.
23 changes: 21 additions & 2 deletions fasttracktojquery/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
.description {
width: 250px;
height: 300px;
padding: 30px 10px;
}
</style>

Expand Down Expand Up @@ -73,7 +74,7 @@ <h1 class='header'>Hello, world!</h1>
<!-- Optional JavaScript -->
<!-- jQuery first, then Popper.js, then Bootstrap JS -->
<script src='https://code.jquery.com/jquery-3.2.1.min.js'></script>
<script type="text/javascript">
<!-- <script type="text/javascript">
$(document).ready(function(){
var num = 124
var someString = "some string"
Expand All @@ -98,7 +99,7 @@ <h1 class='header'>Hello, world!</h1>
})
</script>
</script> -->



Expand Down Expand Up @@ -136,6 +137,24 @@ <h1 class='header'>Hello, world!</h1>



<script type="text/javascript">
$(document).ready(function(){
var $descriptionItems = $(".description")
// console.log($descriptionItems.length) // 0, 1, 2

$.each($descriptionItems, function(index, obj){
var item = $(this)
var actualHeight = item[0].scrollHeight
var shouldBeHeight = item.height()
console.log(actualHeight, shouldBeHeight)
if (actualHeight > shouldBeHeight + 50){
item.css("overflow-y", "scroll")
}
// console.log(index, item.height())
// console.log(index, obj)
})
})
</script>



Expand Down

0 comments on commit d4b8fed

Please sign in to comment.