This is an example of a scenario I have got:
<div id="portfolio">
<a class="show-project" href="#">
<!-- some content here -->
</a>
<div class="scrollable">
<!-- full height container with scroll -->
</div>
</div>
When link is clicked, additional class is added to "scrollable move-left". I would like to detect when it is added and replace css "overflow-y: auto;" with "overflow-y: hidden;"
I am trying to achieve this with:
<script>
$(document).ready(function () {
$("#portfolio .show-project").click(function(){
if ($("#portfolio .scrollable").hasClass("move-left")) {
$("#portfolio").css("overflow-y", "hidden");
} else {
$("#portfolio").css("overflow-y", "auto");
}
});
});
</script>
Could you advice me how to fix this please? Very appreciated!