mirror of
https://github.com/zulip/zulip.git
synced 2025-11-12 18:06:44 +00:00
Properly handle refocusing pointer on both scroll and mousewheel events.
When you're at the top of the page, you don't get scroll events anymore if you're scrolling with a mousewheel. So we need to listen to mousewheel as well as scroll. (Why not *just* mousewheel? Because then the scrolling done by PageUp and PageDown no longer causes the pointer to refocus, because those trigger scroll events.) (imported from commit 4ee23004f6e090abaabb836f0a9d7b59d0394ced)
This commit is contained in:
@@ -114,14 +114,16 @@ $(function () {
|
|||||||
sub_from_home(compose_class_name(), $('#class-nosub'));
|
sub_from_home(compose_class_name(), $('#class-nosub'));
|
||||||
});
|
});
|
||||||
|
|
||||||
var last_mousewheel = 0;
|
var last_mousewheel_or_scroll = 0;
|
||||||
$("#main_div").mousewheel(function () {
|
function do_mousewheel_or_scroll () {
|
||||||
var time = $.now();
|
var time = $.now();
|
||||||
if (time - last_mousewheel > 50) {
|
if (time - last_mousewheel_or_scroll > 50) {
|
||||||
keep_pointer_in_view();
|
keep_pointer_in_view();
|
||||||
last_mousewheel = time;
|
last_mousewheel_or_scroll = time;
|
||||||
}
|
}
|
||||||
});
|
}
|
||||||
|
$(window).mousewheel(do_mousewheel_or_scroll);
|
||||||
|
$(window).scroll(do_mousewheel_or_scroll);
|
||||||
|
|
||||||
$('.button-slide').click(function () {
|
$('.button-slide').click(function () {
|
||||||
show_compose('class', $("#class"));
|
show_compose('class', $("#class"));
|
||||||
|
|||||||
Reference in New Issue
Block a user