The following is not working as expected, it’s not picking up the alert message when you click on ‘.arrow-_down_img’
function slideDown_Menu(){
$('.main_nav').slideDown('slow', function(){
$('.arrow_down_img').removeClass('arrow_down_img').addClass('arrow_up_img');
});
}
function slideUp_Menu(){
$('.main_nav').slideUp('slow', function(){
$('.arrow_up_img').removeClass('arrow_up_img').addClass('arrow_down_img');
});
}
$('.arrow_down_img').click(function(){
// evt.preventDefault();
// slideDown_Menu();
alert('test');
});
$('.arrow_up_img').click(function(evt){
evt.preventDefault();
slideUp_Menu();
});
HTML
<div class="arrow_up">
<div class="arrow_up_img"></div>
</div>
As there is no element with class of
.arrow_down_imgon DOMReady, you should delegate the event, from one of static parents of the element or document object.Also note that in your click handler
evtis undefined.