Could someone help me figure out why the image clip value isn't changing when I move the range slider in the code below?
$('#myRange').on('input', function() {
var nn = $(this).val();
$("img").css({
'clip': 'rect(0% ' + nn + '%, 0%, 0%)',
'-webkit-clip-path': 'inset(0% ' + nn + '%, 0%, 0%)',
'clip-path': 'inset(0% ' + nn + '%, 0%, 0%)'
});
});
img {
clip: rect(0% 50% 0% 0%);
-webkit-clip-path: inset(0% 50% 0% 0%);
clip-path: inset(0% 50% 0% 0%);
}
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<div class="slidecontainer">
<input type="range" min="1" max="100" value="50" class="slider" id="myRange">
</div>
<img src="https://img.fcbayern.com/image/fetch/f_auto,h_371,q_auto:good,w_660/https://fcbayern.com/binaries/content/gallery/fc-bayern/homepage/saison-19-20/frauen/news/fcb-frauen-mannschaftsbild_getty_270719.jpg/fcb-frauen-mannschaftsbild_getty_270719.jpg/fcbhippo%3Axtralargesixteentonine%3Fv%3D1564992156070"
class="img-fluid">