snipt

Ctrl+h for KB shortcuts

Text only

Reload page on resize

1
2
3
4
5
<script>
$(window).resize(function() {
        location.reload();
});
</script>
https://snipt.net/embed/1512d05d3cbba71deb661a507c119be3/
https://snipt.net/raw/1512d05d3cbba71deb661a507c119be3/
1512d05d3cbba71deb661a507c119be3
text
Text only
5
2016-09-24T03:38:38
True
False
False
Dec 15, 2015 at 08:58 AM
/api/public/snipt/143077/
reload-page-on-resize
<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 id="L-1"><a name="L-1"></a>&lt;script&gt; </span><span id="L-2"><a name="L-2"></a>$(window).resize(function() { </span><span id="L-3"><a name="L-3"></a> location.reload(); </span><span id="L-4"><a name="L-4"></a>}); </span><span id="L-5"><a name="L-5"></a>&lt;/script&gt; </span></pre></div> </td></tr></table>
javascript, responsive

Text only

Make div same height as width javascript

1
2
3
4
5
<script>
    $('.responsive').each(function(){
        $(this).height($(this).width());
});
</script>
https://snipt.net/embed/8f0dbcf6a292830373cd910ca69cb1c9/
https://snipt.net/raw/8f0dbcf6a292830373cd910ca69cb1c9/
8f0dbcf6a292830373cd910ca69cb1c9
text
Text only
5
2016-09-22T18:58:13
True
False
False
/api/public/snipt/143076/
make-div-same-height-as-width-javascript
<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 id="L-1"><a name="L-1"></a>&lt;script&gt; </span><span id="L-2"><a name="L-2"></a> $(&#39;.responsive&#39;).each(function(){ </span><span id="L-3"><a name="L-3"></a> $(this).height($(this).width()); </span><span id="L-4"><a name="L-4"></a>}); </span><span id="L-5"><a name="L-5"></a>&lt;/script&gt; </span></pre></div> </td></tr></table>
javascript, responsive
Copyrighted, illegal, or inappropriate content? Email support@snipt.net.