Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>You may not want to add the whole jquery ui library just for this purpose. If I'm right here's, how you'd do it.</p> <p>So, when you 'focus' that input - lets call it 'opensModal' - you want the modal to open. It's pretty simple, and self explanatory - despite the "long" code. Actually, most of it is just there to make the modal/modal appearance prettier. Here we go:</p> <p>HTML:</p> <pre><code>&lt;!-- the input --&gt; &lt;input class="opensModal" type="text" /&gt; &lt;!-- the modal and its overlay --&gt; &lt;div class="modalOverlay is-inactive"&gt; &lt;div class="modal"&gt; &lt;input type="checkbox" /&gt; &lt;input type="checkbox" /&gt; &lt;button&gt;Ok&lt;/button&gt; &lt;button&gt;Cancel&lt;/button&gt; &lt;/div&gt; &lt;/div&gt; </code></pre> <p>CSS:</p> <pre><code>.modalOverlay { position: fixed; top: 0; bottom: 0; left: 0; right: 0; -webkit-transition: 0.6s; } .modalOverlay.is-inactive { visibility: hidden; background: rgba(0, 0, 0, 0); } .modalOverlay.is-active { visibility: visible; background: rgba(0, 0, 0, 0.4); } .modal { margin: 100px auto; background: #fff; width: 100px; padding: 20px; -webkit-transition: 0.4s 0.6s; } .modalOverlay.is-inactive .modal { visibility: hidden; opacity: 0; -webkit-transform: scale(0.1); } .modalOverlay.is-active .modal { visibility: visible; opacity: 1; -webkit-transform: scale(1); } </code></pre> <p>JQUERY(javascript)</p> <pre><code>(function () { var $modal = $('.modalOverlay'), openModal = function () { $modal .removeClass('is-inactive') .addClass('is-active'); }, closeModal = function () { //use it wherever you want $modal .removeClass('is-active') .addClass('is-inactive'); }, onDocReady = function () { $('.opensModal').on('focus', openModal); }; $(onDocReady); })(); </code></pre> <p>Here's a fiddle: <a href="http://jsfiddle.net/2edPZ/3/" rel="nofollow">http://jsfiddle.net/2edPZ/3/</a></p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload