Hello, I am having a problem trying to exclude some "#divs" from a scrolling function.

The problem I have is that I use a scrolling script that slides the page vertically to some defined div "#anchors"

But I am trying to build some sliding tabs as well, the problem is that when clicking the tabs I am triggering the "scroll page" script instead of the tabs sliding script, so I am wondering if I can exclude the tabs menu "#divs" from the scroll page script so that there is no conflict. Please let me know if this is possible, is very important for me, thanks!

here is the scrolling script:

$(document).ready(function(){

$('a[href*=#]').click(function() {
if (location.pathname.replace(/^\//,'') == this.pathname.replace(/^\//,'')

&& location.hostname == this.hostname) {
var $target = $(this.hash);
$target = $target.length && $target
|| $('[name=' + this.hash.slice(1) +']');
if ($target.length) {
var targetOffset = $target.offset().top;
$('html,body')
.animate({scrollTop: targetOffset}, 1000);
return false;
}
}

});


});


And here is what I tried doing, but it is not working:

$(document).ready(function(){


$("#first").click(function() {
window.onbeforeunload = null;
});

$("#second").click(function() {
window.onbeforeunload = null;
});

$("#third").click(function() {
window.onbeforeunload = null;
});

$('a[href*=#]').click(function() {
if (location.pathname.replace(/^\//,'') == this.pathname.replace(/^\//,'')

&& location.hostname == this.hostname) {
var $target = $(this.hash);
$target = $target.length && $target
|| $('[name=' + this.hash.slice(1) +']');
if ($target.length) {
var targetOffset = $target.offset().top;
$('html,body')
.animate({scrollTop: targetOffset}, 1000);
return false;
}
}




});


});