I try to create a variable on click, and to use it on another onclick action. But it seems that the variable doesn't exist when the second onclick try to use it.
$( "#search" ).click(function() {
var myVariable = $(document).scrollTop();
});
$( "#gachette" ).click(function() {
$('html, body').animate({scrollTop:myVariable}, 10);
});
Do you have an idea why it doesn't work?