I am pretty new to JS - so just wondering whether you know how to solve this problem.
Current I have in my code
return false is the answer, but I usually do this instead:
$('.closeLink').click( function(event) { event.preventDefault(); ...do the close action... });
Stops the action from happening before you run your code.