1
Hello,
By triggering the scroll
, i add a class
to div-operador
, causing a box-shadow
, at the top of div-operador
.
But as picture below, the input elements, select, etc... are above the shadow.
How do I make the top shadow overlap the elements that are inside the div-operador
when rolled up ?
javascritp
$('#div-operador"').scroll(function() {
var y = $(this).scrollTop();
if (y > 1) {
$('#div-operador').addClass('shadow');
}
else {
$('#div-operador').removeClass('shadow');
}
});
CSS
#div-operador {
padding-top: 5px;
overflow: auto;
width: auto;
max-height: 205px;
height: 205px;
}
.shadow {
box-shadow: inset 0 7px 9px -7px rgba(0,0,0,0.7);
z-index:5;
}
html
<div class="col-xs-8">
<div id="div-operador" class="col-md-12">
<div class="row clearfix">
<div class="col-xs-6">
<div class="form-group">
<label for="sel-perfil">Perfil</label>
<select id="sel-perfil" class="form-control input-sm form-md-3" name="perfil" title="Perfil" autocomplete="off" required >
<option>Perfil</option>
</select>
</div>
</div>
<div class="col-xs-6">
<div class="form-group">
<label for="sel-nivel">Nível</label>
<select id="sel-nivel" class="form-control input-sm form-md-3" name="nivel" title="nivel" autocomplete="off" required >
<option>Perfil</option>
</select>
</div>
</div>
<div class="col-xs-6">
<div class="form-group">
<label for="sel-email">email</label>
<input type="text" id="txt-email" class="form-control input-sm form-md-3" name="email" autocomplete="off" required />
</div>
</div>
<div class="col-xs-6">
<div class="form-group">
<label for="txt-login">login</label>
<input type="text" id="txt-login" class="form-control input-sm form-md-3" name="login" autocomplete="off" required />
</div>
</div>
</div>
</div>
</div>
But only with this HTML snippet is it not possible to simulate your problem. Please edit and include the rest of the code so that it is possible to simulate the problem. Because this code is very far from what is in the image...
– hugocsl
This HTML code serves to simulate the problem, the only question, I that there are several
cols-xs-6
within the div-operator beyond what is in the example, and thediv-operador
is inside another div– Wagner Fillio
I edited the question and added other details
– Wagner Fillio
@Wagnerfilho tried to simulate his code for solution, but details of the HTML structure are missing. However when observing superficially you notice that you assign the z-index only to the class you enter via jQuery. Assign z-index directly to the parent class of the element.
– Getulio Rafael Ferreira
Didn’t work, added z-index and position relative
– Wagner Fillio