☰Read-only archive⌕
Looking for help with Bokeh?

This is a read-only archive. Ask questions and join the conversation on GitHub.

Visit Community Support on GitHub →
Archived discussions · Captured October 28, 2026

Stop web browser scroll on wheel event

Community Support
dan.cutright
dan.cutright

Does anyone know how to prevent your web browser from scrolling on wheel events?

I’m trying to scroll through a 3D data set, using the mouse wheel to scroll through the z-axis. The code below works great, but the web browser will still scroll on these events. I could not find the Bokeh source code that illustrates how they do this for WheelZoomTool. Presumably this requires some custom JS?

my_figure.on_event(events.MouseWheel, my_wheel_function)

def my_wheel_function(event):

if scrolling_check_box.active:

if event.delta > 0:

go_to_next_slice()

elif event.delta < 0:

go_to_previous_slice()

``

⌁   Link to post
Bryan
Bryan

Hi,

That happens here:

  https://github.com/bokeh/bokeh/blob/master/bokehjs/src/coffee/core/ui_events.coffee#L185-L188

You'll probably need to make a custom extension to do this, I doubt it's possible using only the event. The existing wheel zoom tool implementation is here:

  https://github.com/bokeh/bokeh/blob/master/bokehjs/src/coffee/models/tools/gestures/wheel_zoom_tool.coffee

You can probably gut it and make a "do-nothing" scroll tool extension. Just be virtue of being activated/deactivated the stop propagation mode will be enabled or disabled. Then the python event will be useful while the tool is active.

Thanks,

Bryan

···

On Oct 15, 2017, at 11:36, dan.cutright@gmail.com wrote:

Does anyone know how to prevent your web browser from scrolling on wheel events?

I'm trying to scroll through a 3D data set, using the mouse wheel to scroll through the z-axis. The code below works great, but the web browser will still scroll on these events. I could not find the Bokeh source code that illustrates how they do this for WheelZoomTool. Presumably this requires some custom JS?

my_figure.on_event(events.MouseWheel, my_wheel_function)

def my_wheel_function(event):
    if scrolling_check_box.active:
        if event.delta > 0:
            go_to_next_slice()
        elif event.delta < 0:
            go_to_previous_slice()

--
You received this message because you are subscribed to the Google Groups "Bokeh Discussion - Public" group.
To unsubscribe from this group and stop receiving emails from it, send an email to bokeh+unsubscribe@continuum.io.
To post to this group, send email to bokeh@continuum.io.
To view this discussion on the web visit https://groups.google.com/a/continuum.io/d/msgid/bokeh/9eee50d0-99dc-4458-9a2d-018d25afc033%40continuum.io\.
For more options, visit https://groups.google.com/a/continuum.io/d/optout\.

⌁   Link to post
dan.cutright
dan.cutright

Thanks Bryan!

···

On Sunday, October 15, 2017 at 10:54:03 PM UTC-5, Bryan Van de ven wrote:

Hi,

That happens here:

    [https://github.com/bokeh/bokeh/blob/master/bokehjs/src/coffee/core/ui_events.coffee#L185-L188](https://github.com/bokeh/bokeh/blob/master/bokehjs/src/coffee/core/ui_events.coffee#L185-L188)

You’ll probably need to make a custom extension to do this, I doubt it’s possible using only the event. The existing wheel zoom tool implementation is here:

    [https://github.com/bokeh/bokeh/blob/master/bokehjs/src/coffee/models/tools/gestures/wheel_zoom_tool.coffee](https://github.com/bokeh/bokeh/blob/master/bokehjs/src/coffee/models/tools/gestures/wheel_zoom_tool.coffee)

You can probably gut it and make a “do-nothing” scroll tool extension. Just be virtue of being activated/deactivated the stop propagation mode will be enabled or disabled. Then the python event will be useful while the tool is active.

Thanks,

Bryan

On Oct 15, 2017, at 11:36, dan.cu...@gmail.com wrote:

Does anyone know how to prevent your web browser from scrolling on wheel events?

I’m trying to scroll through a 3D data set, using the mouse wheel to scroll through the z-axis. The code below works great, but the web browser will still scroll on these events. I could not find the Bokeh source code that illustrates how they do this for WheelZoomTool. Presumably this requires some custom JS?

my_figure.on_event(events.MouseWheel, my_wheel_function)

def my_wheel_function(event):

if scrolling_check_box.active:
    if event.delta > 0:
        go_to_next_slice()
    elif event.delta < 0:
        go_to_previous_slice()

–
You received this message because you are subscribed to the Google Groups “Bokeh Discussion - Public” group.

To unsubscribe from this group and stop receiving emails from it, send an email to bokeh+un...@continuum.io.

To post to this group, send email to bo...@continuum.io.

To view this discussion on the web visit https://groups.google.com/a/continuum.io/d/msgid/bokeh/9eee50d0-99dc-4458-9a2d-018d25afc033%40continuum.io.

For more options, visit https://groups.google.com/a/continuum.io/d/optout.

⌁   Link to post

End of archived discussion · Replies are disabled