Jump to content
  • Prevent zoom sliders to zoom when using the mouse wheel


    To prevent zooming with the mouse wheel, add a short JavaScript code to relevant pages, especially when scroll bars are present. This approach disables zoom sliders' functionality.

    To disable zooming with the mouse wheel, you simply add a brief JavaScript code snippet to any text area on the relevant pages. This feature is particularly handy when the page has scroll bars. Below is a screenshot demonstrating the default behavior and the changes after implementing the script.

    preventFromZoomScript.thumb.gif.5e6a27f0962442a72410470f9ef66d7d.gif

     

    And here is the Script

    divsWithZoomSliders = [...document.querySelectorAll(".sf-element.sf-element-visual")].filter(div => div.querySelector(".sf-element-zoom-slider"));
    divsToDisable = divsWithZoomSliders.map(div => div.querySelector(".sf-element.sf-element-canvas-visualization"));
    divsToDisable.forEach(div => {div.firstChild.addEventListener('wheel', function(event) {event.preventDefault()}, { passive: true })});

     

    Please note that this approach is not supported and it might not work properly on future versions of Spotfire

     

    More JavaScript tips and tricks here

     


    User Feedback

    Recommended Comments

    There are no comments to display.


×
×
  • Create New...