I tried to jump after selection with "window.location.hash = '#section3';", but it doesn't work this way..
$('#inputField').typeahead({
source: function (query, process) {
return $.get('test.php', { query: query }, function (data) {
console.log(data);
data = $.parseJSON(data);
return process(data);
});
},
afterSelect: function (item) {
window.location.hash = '#section3';
}
});
Thanks for your help!
Change the window.location to scrollTop
SCRIPT
$('#inputField').typeahead({
source: function (query, process) {
return $.get('test.php', { query: query }, function (data) {
console.log(data);
data = $.parseJSON(data);
return process(data);
});
},
afterSelect: function (item) {
//window.location.hash = '#section3';
$("html, body").animate({ scrollTop: $('#section3').offset().top }, 1000);
}
});