开发者

problem with jquery overriding link href

开发者 https://www.devze.com 2023-02-27 08:49 出处:网络
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

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.

0

精彩评论

暂无评论...
验证码 换一张
取 消