snipt

Ctrl+h for KB shortcuts

JavaScript

jQuery escape key to do something

1
2
3
4
5
6
7
$(document).keyup(function(e) {
  if (e.keyCode == "27") { 
    $('#overlay , .popup').fadeOut(function() {
      $('a.close').remove();  //fade them both out
    });
  }
});
https://snipt.net/embed/5a7efbf9c5a15a5a64ae0fa68adb22c0/
/raw/5a7efbf9c5a15a5a64ae0fa68adb22c0/
5a7efbf9c5a15a5a64ae0fa68adb22c0
js
JavaScript
7
2019-06-16T07:18:26
True
False
False
/api/public/snipt/39123/
jquery-escape-key-to-do-something
<table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre><a href="#L-1">1</a> <a href="#L-2">2</a> <a href="#L-3">3</a> <a href="#L-4">4</a> <a href="#L-5">5</a> <a href="#L-6">6</a> <a href="#L-7">7</a></pre></div></td><td class="code"><div class="highlight"><pre><span></span><span id="L-1"><a name="L-1"></a><span class="nx">$</span><span class="p">(</span><span class="nb">document</span><span class="p">).</span><span class="nx">keyup</span><span class="p">(</span><span class="kd">function</span><span class="p">(</span><span class="nx">e</span><span class="p">)</span> <span class="p">{</span> </span><span id="L-2"><a name="L-2"></a> <span class="k">if</span> <span class="p">(</span><span class="nx">e</span><span class="p">.</span><span class="nx">keyCode</span> <span class="o">==</span> <span class="s2">&quot;27&quot;</span><span class="p">)</span> <span class="p">{</span> </span><span id="L-3"><a name="L-3"></a> <span class="nx">$</span><span class="p">(</span><span class="s1">&#39;#overlay , .popup&#39;</span><span class="p">).</span><span class="nx">fadeOut</span><span class="p">(</span><span class="kd">function</span><span class="p">()</span> <span class="p">{</span> </span><span id="L-4"><a name="L-4"></a> <span class="nx">$</span><span class="p">(</span><span class="s1">&#39;a.close&#39;</span><span class="p">).</span><span class="nx">remove</span><span class="p">();</span> <span class="c1">//fade them both out</span> </span><span id="L-5"><a name="L-5"></a> <span class="p">});</span> </span><span id="L-6"><a name="L-6"></a> <span class="p">}</span> </span><span id="L-7"><a name="L-7"></a><span class="p">});</span> </span></pre></div> </td></tr></table>
jquert

CSS

CSS Reset in one line

html,body,div,span,applet,object,iframe,h1,h2,h3,h4,h5,h6,p,blockquote,pre,hr,a,abbr,address,cite,code,del,dfn,em,img,ins,kbd,q,s,samp,small,strong,sub,sup,tt,var,b,u,i,dl,dt,dd,ol,ul,li,fieldset,form,label,legend,table,caption,tbody,tfoot,thead,tr,th,td,article,aside,canvas,details,figcaption,figure,footer,header,hgroup,menu,nav,section,summary,time,mark,audio,video{margin:0;padding:0;}article,aside,details,figcaption,figure,footer,header,hgroup,menu,nav,section{display:block;}h1,h2,h3,h4,h5,h6{font-size:100%;}table{border-collapse:collapse;border-spacing:0;}strong,b,mark{font-weight:700;font-style:inherit;}em,i,cite,q,address,dfn,var{font-style:italic;font-weight:inherit;}abbr[title],dfn[title]{cursor:help;border-bottom:1px dotted;}ins{border-bottom:1px solid;}a,u,ins{text-decoration:none;}del,s{text-decoration:line-through;}pre,code,samp,kbd{font-family:monospace;}small{font-size:0.75em;}img{border:none;font-style:italic;}input,select,option,optgroup,textarea{font:inherit;}
https://snipt.net/embed/d7652d26964e1d606f3f4db4d40213b0/
/raw/d7652d26964e1d606f3f4db4d40213b0/
d7652d26964e1d606f3f4db4d40213b0
css
CSS
1
2019-06-18T04:18:01
True
False
False
/api/public/snipt/38402/
necolas-normalizecss-in-one-line
<table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre><a href="#L-1">1</a></pre></div></td><td class="code"><div class="highlight"><pre><span></span><span id="L-1"><a name="L-1"></a><span class="nt">html</span><span class="o">,</span><span class="nt">body</span><span class="o">,</span><span class="nt">div</span><span class="o">,</span><span class="nt">span</span><span class="o">,</span><span class="nt">applet</span><span class="o">,</span><span class="nt">object</span><span class="o">,</span><span class="nt">iframe</span><span class="o">,</span><span class="nt">h1</span><span class="o">,</span><span class="nt">h2</span><span class="o">,</span><span class="nt">h3</span><span class="o">,</span><span class="nt">h4</span><span class="o">,</span><span class="nt">h5</span><span class="o">,</span><span class="nt">h6</span><span class="o">,</span><span class="nt">p</span><span class="o">,</span><span class="nt">blockquote</span><span class="o">,</span><span class="nt">pre</span><span class="o">,</span><span class="nt">hr</span><span class="o">,</span><span class="nt">a</span><span class="o">,</span><span class="nt">abbr</span><span class="o">,</span><span class="nt">address</span><span class="o">,</span><span class="nt">cite</span><span class="o">,</span><span class="nt">code</span><span class="o">,</span><span class="nt">del</span><span class="o">,</span><span class="nt">dfn</span><span class="o">,</span><span class="nt">em</span><span class="o">,</span><span class="nt">img</span><span class="o">,</span><span class="nt">ins</span><span class="o">,</span><span class="nt">kbd</span><span class="o">,</span><span class="nt">q</span><span class="o">,</span><span class="nt">s</span><span class="o">,</span><span class="nt">samp</span><span class="o">,</span><span class="nt">small</span><span class="o">,</span><span class="nt">strong</span><span class="o">,</span><span class="nt">sub</span><span class="o">,</span><span class="nt">sup</span><span class="o">,</span><span class="nt">tt</span><span class="o">,</span><span class="nt">var</span><span class="o">,</span><span class="nt">b</span><span class="o">,</span><span class="nt">u</span><span class="o">,</span><span class="nt">i</span><span class="o">,</span><span class="nt">dl</span><span class="o">,</span><span class="nt">dt</span><span class="o">,</span><span class="nt">dd</span><span class="o">,</span><span class="nt">ol</span><span class="o">,</span><span class="nt">ul</span><span class="o">,</span><span class="nt">li</span><span class="o">,</span><span class="nt">fieldset</span><span class="o">,</span><span class="nt">form</span><span class="o">,</span><span class="nt">label</span><span class="o">,</span><span class="nt">legend</span><span class="o">,</span><span class="nt">table</span><span class="o">,</span><span class="nt">caption</span><span class="o">,</span><span class="nt">tbody</span><span class="o">,</span><span class="nt">tfoot</span><span class="o">,</span><span class="nt">thead</span><span class="o">,</span><span class="nt">tr</span><span class="o">,</span><span class="nt">th</span><span class="o">,</span><span class="nt">td</span><span class="o">,</span><span class="nt">article</span><span class="o">,</span><span class="nt">aside</span><span class="o">,</span><span class="nt">canvas</span><span class="o">,</span><span class="nt">details</span><span class="o">,</span><span class="nt">figcaption</span><span class="o">,</span><span class="nt">figure</span><span class="o">,</span><span class="nt">footer</span><span class="o">,</span><span class="nt">header</span><span class="o">,</span><span class="nt">hgroup</span><span class="o">,</span><span class="nt">menu</span><span class="o">,</span><span class="nt">nav</span><span class="o">,</span><span class="nt">section</span><span class="o">,</span><span class="nt">summary</span><span class="o">,</span><span class="nt">time</span><span class="o">,</span><span class="nt">mark</span><span class="o">,</span><span class="nt">audio</span><span class="o">,</span><span class="nt">video</span><span class="p">{</span><span class="nb">margin</span><span class="o">:</span><span class="m">0</span><span class="p">;</span><span class="nb">padding</span><span class="o">:</span><span class="m">0</span><span class="p">;}</span><span class="nt">article</span><span class="o">,</span><span class="nt">aside</span><span class="o">,</span><span class="nt">details</span><span class="o">,</span><span class="nt">figcaption</span><span class="o">,</span><span class="nt">figure</span><span class="o">,</span><span class="nt">footer</span><span class="o">,</span><span class="nt">header</span><span class="o">,</span><span class="nt">hgroup</span><span class="o">,</span><span class="nt">menu</span><span class="o">,</span><span class="nt">nav</span><span class="o">,</span><span class="nt">section</span><span class="p">{</span><span class="nb">display</span><span class="o">:</span><span class="nb">block</span><span class="p">;}</span><span class="nt">h1</span><span class="o">,</span><span class="nt">h2</span><span class="o">,</span><span class="nt">h3</span><span class="o">,</span><span class="nt">h4</span><span class="o">,</span><span class="nt">h5</span><span class="o">,</span><span class="nt">h6</span><span class="p">{</span><span class="nb">font-size</span><span class="o">:</span><span class="m">100%</span><span class="p">;}</span><span class="nt">table</span><span class="p">{</span><span class="nb">border-collapse</span><span class="o">:</span><span class="nb">collapse</span><span class="p">;</span><span class="nb">border-spacing</span><span class="o">:</span><span class="m">0</span><span class="p">;}</span><span class="nt">strong</span><span class="o">,</span><span class="nt">b</span><span class="o">,</span><span class="nt">mark</span><span class="p">{</span><span class="nb">font-weight</span><span class="o">:</span><span class="m">700</span><span class="p">;</span><span class="nb">font-style</span><span class="o">:</span><span class="nb">inherit</span><span class="p">;}</span><span class="nt">em</span><span class="o">,</span><span class="nt">i</span><span class="o">,</span><span class="nt">cite</span><span class="o">,</span><span class="nt">q</span><span class="o">,</span><span class="nt">address</span><span class="o">,</span><span class="nt">dfn</span><span class="o">,</span><span class="nt">var</span><span class="p">{</span><span class="nb">font-style</span><span class="o">:</span><span class="nb">italic</span><span class="p">;</span><span class="nb">font-weight</span><span class="o">:</span><span class="nb">inherit</span><span class="p">;}</span><span class="nt">abbr</span><span class="o">[</span><span class="nt">title</span><span class="o">],</span><span class="nt">dfn</span><span class="o">[</span><span class="nt">title</span><span class="o">]</span><span class="p">{</span><span class="nb">cursor</span><span class="o">:</span><span class="nb">help</span><span class="p">;</span><span class="nb">border-bottom</span><span class="o">:</span><span class="m">1px</span> <span class="nb">dotted</span><span class="p">;}</span><span class="nt">ins</span><span class="p">{</span><span class="nb">border-bottom</span><span class="o">:</span><span class="m">1px</span> <span class="nb">solid</span><span class="p">;}</span><span class="nt">a</span><span class="o">,</span><span class="nt">u</span><span class="o">,</span><span class="nt">ins</span><span class="p">{</span><span class="nb">text-decoration</span><span class="o">:</span><span class="nb">none</span><span class="p">;}</span><span class="nt">del</span><span class="o">,</span><span class="nt">s</span><span class="p">{</span><span class="nb">text-decoration</span><span class="o">:</span><span class="nb">line-through</span><span class="p">;}</span><span class="nt">pre</span><span class="o">,</span><span class="nt">code</span><span class="o">,</span><span class="nt">samp</span><span class="o">,</span><span class="nt">kbd</span><span class="p">{</span><span class="nb">font-family</span><span class="o">:</span><span class="nb">monospace</span><span class="p">;}</span><span class="nt">small</span><span class="p">{</span><span class="nb">font-size</span><span class="o">:</span><span class="m">0.75em</span><span class="p">;}</span><span class="nt">img</span><span class="p">{</span><span class="nb">border</span><span class="o">:</span><span class="nb">none</span><span class="p">;</span><span class="nb">font-style</span><span class="o">:</span><span class="nb">italic</span><span class="p">;}</span><span class="nt">input</span><span class="o">,</span><span class="nt">select</span><span class="o">,</span><span class="nt">option</span><span class="o">,</span><span class="nt">optgroup</span><span class="o">,</span><span class="nt">textarea</span><span class="p">{</span><span class="nb">font</span><span class="o">:</span><span class="nb">inherit</span><span class="p">;}</span> </span></pre></div> </td></tr></table>
css, reset