jquery link problems
$(".questionsList").toggle(function() {
$('#slider').animate({ left: '375' }, 开发者_如何学Python500);
}, function() {
$('#slider').animate({ left: '0'}, 500);
});
$(".questionsList h1 a").click(function() {
?????
});
I have a div .questionsList
, that when clicked, causes another section called #slider
to slide out (hence the name). Inside .questionsList
is a link, that when clicked, I do NOT want to cause the div to slide out but instead I want to follow the link's href.
If I replace the ???? part in the code with return false; neither the jquery or the link's href fires when the link is clicked. Thus I need help!
This will stop the event from bubbling up and calling its ancestors' events.
$(".questionsList h1 a").click(function(event) {
event.stopPropagation();
});
精彩评论