• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers

Mouse wheel double click

Explorer ,
Oct 28, 2020 Oct 28, 2020

Copy link to clipboard

Copied

Does anyone know of any widgets (for HTML5) that would listen for a mouse wheel double click? My limited javascript skills (i.e. copying other people's code examples) aren't working for me!

To explain, in the software we are recording a mouse wheel double click returns the application to a default zoom level. There is no button or other way to achieve the same thing in the software, so we'd like to find a way to simulate this task.

Thanks in advance!

Views

561

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Community Expert , Oct 30, 2020 Oct 30, 2020

This JavaScript will do the trick. Change yourelement name to the name of the Captivate element.

var count = 0;
var timeout;

var myButton = document.getElementById("yourelementname")
myButton.addEventListener("auxclick", captureMouseWheel, false);

function captureMouseWheel( e )
{
if ( e.button == 1 )
{
count++;

if ( !timeout )
{
timeout = setTimeout( function()
{
timeout = undefined;
check();
}, 250);
}
}
else
{
count = 0;
}
}

function check()
{
if ( count >= 2 )
{
//mousewheel doubleclicked
}

count = 0;
}

Likes

Translate

Translate
Community Expert ,
Oct 28, 2020 Oct 28, 2020

Copy link to clipboard

Copied

Normal Click Boxes in Captivate have the option for respoinding to a Double-Mouse Click.

 

But if you want more flexibility and options for HTML5 then the CpExtra HTML5 widget is the only other solution I know of: https://infosemantics.com.au/about-cpextra/

https://widgetking.github.io/cpextra/features/events-list.html#double-click

https://widgetking.github.io/cpextra/features/events-list.html#double-click

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Oct 28, 2020 Oct 28, 2020

Copy link to clipboard

Copied

However, please bear in mind that your situation is very different to a normal interaction.  Having to listen for a double click event on the mouse wheel (not a mouse button) might be next to impossible to achieve without custom coding.

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Oct 29, 2020 Oct 29, 2020

Copy link to clipboard

Copied

Thanks Rod. I do have your cpextra widget, but unfortunately the double click doesn't register for the mouse wheel. I'll keep fighting with my dodgy javascript and see if I can get there!

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Oct 30, 2020 Oct 30, 2020

Copy link to clipboard

Copied

This JavaScript will do the trick. Change yourelement name to the name of the Captivate element.

var count = 0;
var timeout;

var myButton = document.getElementById("yourelementname")
myButton.addEventListener("auxclick", captureMouseWheel, false);

function captureMouseWheel( e )
{
if ( e.button == 1 )
{
count++;

if ( !timeout )
{
timeout = setTimeout( function()
{
timeout = undefined;
check();
}, 250);
}
}
else
{
count = 0;
}
}

function check()
{
if ( count >= 2 )
{
//mousewheel doubleclicked
}

count = 0;
}

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Nov 03, 2020 Nov 03, 2020

Copy link to clipboard

Copied

Thanks so much. That's very generous of you!

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Nov 07, 2022 Nov 07, 2022

Copy link to clipboard

Copied

LATEST

The mouse click on my computer hasn't been working properly for the past month. I'm testing my mouse for this website Macrotester. then I want to change

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines