I have an element that is draggable through jQueryUI. I am using it to do a pull-down to refresh interaction.
What I am trying to accomplish is when the user has scrolled to the top of the window / body, but attempts to scroll further, then as per the distance the user scrolls up, this element ( #main
) is dragged down.
How I planned to drag it down is by simulating the .mousedown()
and and .mousemove()
and `.mouseup() events, which seem to work ( meaning they trigger the drag ).
Here is what I think should work in some-real / some-pseudo code:
$(window).on('scroll', function(){
if($(this).scrollTop() === 0){
if(extra movement beyond scrollTop 0){
$('#main').mousedown();
//move #main down number of pixels of extra movement / extra scroll up.
$('#main').mouseup();
}
}
});