snipt

Ctrl+h for KB shortcuts

JavaScript

Detect animation end jQuery/CSS

1
2
3
4
5
el.one('webkitAnimationEnd oanimationend msAnimationEnd animationend',   
function(e) {
    // code to execute after animation ends    
    myBox.removeClass('change-size');
});
https://snipt.net/embed/b71bacffabc246414df93af4df6860dc/
/raw/b71bacffabc246414df93af4df6860dc/
b71bacffabc246414df93af4df6860dc
js
JavaScript
5
2019-06-11T22:18:37
True
False
False
/api/public/snipt/114964/
detect-animation-end-jquerycss
<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></pre></div></td><td class="code"><div class="highlight"><pre><span></span><span id="L-1"><a name="L-1"></a><span class="nx">el</span><span class="p">.</span><span class="nx">one</span><span class="p">(</span><span class="s1">&#39;webkitAnimationEnd oanimationend msAnimationEnd animationend&#39;</span><span class="p">,</span> </span><span id="L-2"><a name="L-2"></a><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-3"><a name="L-3"></a> <span class="c1">// code to execute after animation ends </span> </span><span id="L-4"><a name="L-4"></a> <span class="nx">myBox</span><span class="p">.</span><span class="nx">removeClass</span><span class="p">(</span><span class="s1">&#39;change-size&#39;</span><span class="p">);</span> </span><span id="L-5"><a name="L-5"></a><span class="p">});</span> </span></pre></div> </td></tr></table>
css, jquery, js

JavaScript

Add viewport tag to head with jQuery

//useful for jsfiddle
$('head').append('<meta name="viewport" content="width=device-width, initial-scale=1, minimum-scale=1, maximum-scale=1" />');
https://snipt.net/embed/436b83cbffb758473413035d5f34ed3b/
/raw/436b83cbffb758473413035d5f34ed3b/
436b83cbffb758473413035d5f34ed3b
js
JavaScript
2
2019-06-17T06:57:42
True
False
False
Feb 18, 2014 at 11:15 AM
/api/public/snipt/114793/
add-viewport-tag-to-head-with-jquery
<table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre><a href="#L-1">1</a> <a href="#L-2">2</a></pre></div></td><td class="code"><div class="highlight"><pre><span></span><span id="L-1"><a name="L-1"></a><span class="c1">//useful for jsfiddle</span> </span><span id="L-2"><a name="L-2"></a><span class="nx">$</span><span class="p">(</span><span class="s1">&#39;head&#39;</span><span class="p">).</span><span class="nx">append</span><span class="p">(</span><span class="s1">&#39;&lt;meta name=&quot;viewport&quot; content=&quot;width=device-width, initial-scale=1, minimum-scale=1, maximum-scale=1&quot; /&gt;&#39;</span><span class="p">);</span> </span></pre></div> </td></tr></table>
head, javascript, jquery, viewport

Text only

Load jQuery from Google CDN , or load from your site if it's not available!

<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script><script>window.jQuery || document.write('<script src="http://website.com/js/jquery-1.8.2.min.js"><\/script>')</script>
https://snipt.net/embed/877a66c9a0c13e0799d70ddb40d7474e/
/raw/877a66c9a0c13e0799d70ddb40d7474e/
877a66c9a0c13e0799d70ddb40d7474e
text
Text only
1
2019-02-13T20:13:47
True
False
True
Feb 12, 2014 at 12:21 PM
/api/public/snipt/113085/
load-jquery-from-google-cdn-or-load-from-your-site-if-its-not-available
<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>&lt;script src=&quot;http://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js&quot;&gt;&lt;/script&gt;&lt;script&gt;window.jQuery || document.write(&#39;&lt;script src=&quot;http://website.com/js/jquery-1.8.2.min.js&quot;&gt;&lt;\/script&gt;&#39;)&lt;/script&gt; </span></pre></div> </td></tr></table>
cdn, jquery