fredwu / jquery-endless-scroll

Endless/infinite scrolling/pagination.
http://fredwu.github.com/jquery-endless-scroll/
837 stars 176 forks source link

"Go to Top" of a div on which jquery-endless-scroll is used #41

Open tgpraveen opened 10 years ago

tgpraveen commented 10 years ago

Hi,

Is there some obvious way, maybe some feature of the plugin, to go to top of a div on which I have jquery-endless-scroll applied.

Currently, I was trying something like:-

function backToTop() { alert("I am here."); var deviceList = $("#list"); var scrollPosition = deviceList.scrollTop(); alert("scrollPosition:- "+scrollPosition); deviceList.scrollTop = 0;

}

And, I have used this plugin successfully on #list. But, the above code which is mapped to a button’s onClick() gives me the scroll scrollPosition value in the alert but the “deviceList.scrollTop = 0;” line doesn’t seem to have any effect.

Any ideas?