$(document).ready(function(){
$(document).on('scroll', function(event){
var target = window.location.hash;
if (typeof hash != 'undefined' && hash != '') {
event.stopPropogation(); // or event.preventDefault();
... // your function from scroll
}
});
});