Cursor button shortcut for next or previous button

This forum is for all Flare issues related to styles, stylesheets and XML.
Post Reply
Matze
Sr. Propeller Head
Posts: 166
Joined: Mon Jun 20, 2016 10:35 pm

Cursor button shortcut for next or previous button

Post by Matze »

Hi all,
is it possible to put a keyboard key on my HTML5 skin buttons?
Now I have to click on next or previous button to jump in the next or previous button.

But would be nice to use left or right cursor button as well.
AlexFox
Sr. Propeller Head
Posts: 164
Joined: Thu Oct 19, 2017 1:56 am

Re: Cursor button shortcut for next or previous button

Post by AlexFox »

You can put some jQuery into the skin that should achieve this, I've tested it locally in devtools but not in an actual build however..

Code: Select all

$(document).keydown(function(e) {
    if (e.which == 39) {
        $(".next-topic-button").click();
    } else if (e.which == 37) {
        $(".previous-topic-button").click();
    }
});
This will click the next topic button if you press the right arrow and click the previous topic button if you press the left arrow.
Matze
Sr. Propeller Head
Posts: 166
Joined: Mon Jun 20, 2016 10:35 pm

Re: Cursor button shortcut for next or previous button

Post by Matze »

Hi Alex,
thanks for the idea. Unfortunatelly does it work only once to the previous and once to the next topic.
My idea was to read the entire topics by using the keyboard without mouse :D .

Maybe something with history.back() and history.forward() event, but I don´t know how coding this :mrgreen:
AlexFox
Sr. Propeller Head
Posts: 164
Joined: Thu Oct 19, 2017 1:56 am

Re: Cursor button shortcut for next or previous button

Post by AlexFox »

I tested putting it in <script> tags in the head of my template page that has the buttons and it works fine for me on every page, perhaps try that?
trent the thief
Propellus Maximus
Posts: 613
Joined: Wed Feb 01, 2006 6:21 am
Location: Off in the dark....

Re: Cursor button shortcut for next or previous button

Post by trent the thief »

Hi Matze,

You might want to ask GPT or Phind.com (my preferred helper) for coding assistance. Either AI may not provide code that works on the first attempt, but I've had excellent results with CSS/JS coding from both. Phind is much more current, too.
Trent.

Certifiable.

Image

umm...
I meant MAD Certified.

Official Propeller Beanie Owner :-)

:flare: Are you on Flare's Slack channels? PM me for an invitation! :flare:
Matze
Sr. Propeller Head
Posts: 166
Joined: Mon Jun 20, 2016 10:35 pm

Re: Cursor button shortcut for next or previous button

Post by Matze »

Thank you, thats great :D
Post Reply