开发者

jquery link problems

开发者 https://www.devze.com 2023-02-27 10:05 出处:网络
$(\".questionsList\").toggle(function() { $(\'#slider\').animate({ left: \'375\' }, 开发者_如何学Python500);
$(".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();
});
0

精彩评论

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