Reputation: 5761
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>
Upvotes: 0
Views: 74
Reputation: 144659
As there is no element with class of .arrow_down_img
on DOMReady, you should delegate the event, from one of static parents of the element or document object.
$(document).on('click', '.arrow_down_img', function(evt){
// evt.preventDefault();
// slideDown_Menu();
alert('test');
});
Also note that in your click handler evt
is undefined.
Upvotes: 1