0
votes

What I'm trying to accomplish is: Clicking on anchor tag that has href like this "href = "#sample"" then the browser scrolls down to the tag that has this id and after that I want to execute the click function that i have been attached to the same anchor tag. What happens now is quite the opposite. First the click event executes then the anchor original ... Thanks in advance.

2

2 Answers

1
votes

Don't see a direct way there, but you can prevent the browser's default behavior (by returning false from your event handler) and manage the scrolling by yourself (take a look at this plugin).

1
votes
$('...').click(function() {
    setTimeout(function() {
        // put real handler here
    }, 0);
});