I have a div (.questionsList
) that contains a link. When the div is clicked, I have an element #slider
that slides out. However, when the link inside the div is clicked, I want to follow that link. The problem is, when I click the link, the jquery slide effect is overriding the link href so the slider slides out and the link does nothing. How can I fix this?
This is the code开发者_运维百科 I was using prior to recognizing the problem.
$(".questionsList").toggle(function() {
$('#slider').animate({ left: '375' }, 500);
}, function() {
$('#slider').animate({ left: '0'}, 500);
});
The behaviour has nothing to do with the piece of code you have shown.
I suspect you have either:
return false;
Or:
event.preventDefault();
Remove any of these from the click
handler for your div and your link should work.
精彩评论