Indicator when div has scrollbar
HTML
<div class="article">
<div class="section">
<div class="inner">
ABCDEFG HIJKLMN OPQRSTUVWXYZ ABCDEFGH IJKLMNOPQ RSTUVWXYZ
</div>
<div class="indicator"></div>
</div>
This one has a long line of text so it has scrollbars and should have the red indicator
</div>
</div>
<div class="article">
<div class="section">
<div class="inner">
ABCDEF
</div>
<div class="indicator"></div>
</div>
This one is short, no scrollbars, should NOT have the indicator
</div>
<div class="article">
<div class="section">
<div class="inner">
ABCDEFG HIJKLMN OPQRSTU VWXYZ
</div>
<div class="indicator"></div>
</div>
This one has a long line of text so it has scrollbars and should have the red indicator
</div>
CSS
.article {
background: silver;
width: 30%;
display: inline-block;
}
.section {
width: 100%;
height: 100px;
overflow: hidden;
position: relative;
}
.inner {
width: auto;
overflow-x: auto;
white-space: nowrap;
}
.indicator {
width: 20px;
height: 20px;
background: red;
position: absolute;
top: 0;
right: 0;
}