Hello. In general, I am interested in the possibility of binding a modal window to the keys of the virtual keyboard, without inserting a piece of the modal window code itself into each key. Let me explain what I mean now:

There is a piece of code:

<a href="#" class="key" data-key="F3"><i class="a">F3</i></a> <a href="#" class="key" data-key="F4"><i class="a">F4</i></a> <a href="#" class="key" data-key="F5"><i class="a">F5</i></a> <a href="#" class="key" data-key="F6"><i class="a">F6</i></a> <a href="#" class="key" data-key="F7"><i class="a">F7</i></a> <a href="#" class="key" data-key="F8"><i class="a">F8</i></a> <a href="#" class="key" data-key="F9"><i class="a">F9</i></a> <a href="#" class="key" data-key="F10"><i class="a">F10</i></a> <a href="#" class="key" data-key="F11"><i class="a">F11</i></a> <a href="#" class="key" data-key="F12"><i class="a">F12</i></a> 

A modal window is attached to each key. Suppose this is F3:

  <a href="#modal-center" class="key" data-key="F3" uk-toggle><i class="a">F3</i> <div id="modal-center" class="uk-flex-top " uk-modal> <div class="uk-modal-dialog uk-modal-body uk-margin-auto-vertical uk-alert-primary"> <button class="uk-modal-close-default" type="button" uk-close></button> <p>123</p> </div> 

So the question arises, is there any other way to bind a modal window to a key without inserting this piece of code into the code of each key?

In principle, there is nothing wrong with that, just another, more easy and less cumbersome way to solve this problem is interesting.

  • Well, then it all depends on what kind of content you want to see in a modal window, opening it with different keys. Most likely, different. It means that you should either make as many different windows with different contents as the keys. Or dynamically display the content in a modal window - depending on which key is pressed. Explain the task. - humster_spb
  • The content on all the keys will be identical, ATP for which they reminded me of this important point. - aloe
  • one
    Then it’s not at all clear what the problem is: make one window with id = "modal-center" write the address href = "# modal-center" in each link, and when you press any key you will open a modal window. - humster_spb
  • :)))) There are no words, as I could not think of it. Apparently a lot of garbage in the head :). Thanks for the answer! :) - aloe

0