My lovely little website has a charming div that hides any content overflowing the wrapper. I'm trying to adjust the margin-top by $value-120px every time a span with the class of .maisfilme is clicked. Here's my current code:
$(document).ready(function (){
$(".maisfilme").on("click", function() {
var $mtop = $(this).css('margin-top');
var $vai = (parseInt($mtop)+ 110 + "px");
$("#filme").css ({
'margin-top' : "-"+$vai
});
});
});
Initially, this code works as intended. It calculates the new margin-top value, adds 120px, and shifts the div upwards. However, the issue arises when clicking on .maisfilme more than once. The function only executes once on subsequent clicks. Can someone please advise me on how to ensure that the function runs each time .maisfilme is clicked?