Is there a way to create a scroll function similar to WhatsApp's search feature?
When the user clicks on the search (located at the bottom)
, I want it to automatically scroll to the last element.
For example, if the user clicks the up button
, it should scroll to chat-6
, then chat-5
, and so on. Similarly, clicking the down button
should scroll downwards unless it is the last item.
function scroll(id){
console.log(id);
$(".container").animate(
{
scrollTop: $("#"+id).offset().top
},
"fast"
);
}
You can find the full code and try it out here: http://jsfiddle.net/p3kar5bb/231/
Unfortunately, the current code is not functioning correctly as intended.