views:

48

answers:

2

It's my first question on SO, so I hope I'm doing it right. Basically, I would like to know how would one go about creating a jQuery event that would trigger when a scroll marker is released if scrolling with mouse (and also when scrolling with keyboard).

When searching the Internet I have found a special scrollstop event here that triggers when scrolling stops, but that includes the case when scrollbar is still being held. Can events somehow be combined, so let's say scrollstop event only triggers when mouse is released also?

(I need to mention that I'm quite new to both Javascript and jQuery and by relation quite newbish regarding their event models so I hope I'm not asking anything obvious).

+1  A: 

No you can't do such a thing. The reason is that you can only catch click events on the page. The scrollbar is part of the browser not the page. Only the scroll event is triggered for you by the browser. The other point is not to limit yourself to desktop computers. Webpages should work fine on mobile browsers. Some of them don't have scrollbars at all. They can trigger scroll event, but click events on a scrollbar would be useless.

The solution for you is to think differently. You may need to reconsider what you're really up to.

“We can't solve problems by using the same kind of thinking we used when we created them.”

Albert Einstein

galambalazs
Thank you for the explanation. Like you mentioned I solved the problem with a totally different approach. I do think though that maybe it could be useful to differentiate when a page is in a 'scrolling state' (e.g. holding a scrollbar, keeping finger on a screen after scrolling) from a 'normal' page state.
alh84001
A: 

It is possible to combine events: http://stackoverflow.com/questions/3279251/jquery-combine-event-functions/3279270#3279270

gearsdigital
thank you, I will look into that for future reference
alh84001
but you don't get click event on the scrollbar, so there's nothing to combine.
galambalazs
I know i can't get an click event on the scrollbar... but he asked also: `Can events somehow be combined...` And that is definitely possible as i commented above ;)
gearsdigital