Could you just toggle div2's visibility with JS when toggling div1? I assume you're using JS to hide div1 so surely there you can toggle div2 in the same block of code?
Using jQuery
<style>
.div2 {
visibility: hidden;
}
</style>
$('.div1').css('visibility', 'hidden');
$('.div2').css('visibility', 'visible');
?
Checking visibility?
if ($('.div1').is(':visible')) {
$('.div2').css('visibility', 'hidden');
}
OR do you want your code separate and so you want to trigger an event from the div1 script when it hides so div2's script activates it's own script to action?