Snipt.net is closing on December 31st, 2016

For more information, please visit this blog post.

snipt

Ctrl+h for KB shortcuts

JavaScript

jquery mobile | array di tutte le pagine

1
2
3
4
5
var arr=new Array()
//array di tutte le pagine
$('div[data-role="page"]').each(function(i) {
	arr[i] = $(this).attr('id');
});
https://snipt.net/embed/00fb77bcd8745033da20ce648b264f45/
https://snipt.net/raw/00fb77bcd8745033da20ce648b264f45/
00fb77bcd8745033da20ce648b264f45
js
JavaScript
5
2016-11-27T20:51:56
True
False
False
/api/public/snipt/30583/
jquery-mobile-array-di-tutte-le-pagine
<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="kd">var</span> <span class="nx">arr</span><span class="o">=</span><span class="k">new</span> <span class="nb">Array</span><span class="p">()</span> </span><span id="L-2"><a name="L-2"></a><span class="c1">//array di tutte le pagine</span> </span><span id="L-3"><a name="L-3"></a><span class="nx">$</span><span class="p">(</span><span class="s1">&#39;div[data-role=&quot;page&quot;]&#39;</span><span class="p">).</span><span class="nx">each</span><span class="p">(</span><span class="kd">function</span><span class="p">(</span><span class="nx">i</span><span class="p">)</span> <span class="p">{</span> </span><span id="L-4"><a name="L-4"></a> <span class="nx">arr</span><span class="p">[</span><span class="nx">i</span><span class="p">]</span> <span class="o">=</span> <span class="nx">$</span><span class="p">(</span><span class="k">this</span><span class="p">).</span><span class="nx">attr</span><span class="p">(</span><span class="s1">&#39;id&#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>
"jquery mobile"

JavaScript

jquery mobile | script per una specifica pagina

1
2
3
4
5
6
7
$( '[data-role=page]' ).live('pageshow', function(event){ 
      var $et = $( event.target ),
            pageID = '#pagina2';
      if( $et.is( pageID )  || $et.children(0).is( pageID ) ){
            //qui lo script
      }
});
https://snipt.net/embed/192f10312f0970bf458e699efd3060d0/
https://snipt.net/raw/192f10312f0970bf458e699efd3060d0/
192f10312f0970bf458e699efd3060d0
js
JavaScript
7
2016-11-18T13:27:53
True
False
False
/api/public/snipt/30582/
jquery-mobile-script-per-una-specifica-pagina
<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="s1">&#39;[data-role=page]&#39;</span> <span class="p">).</span><span class="nx">live</span><span class="p">(</span><span class="s1">&#39;pageshow&#39;</span><span class="p">,</span> <span class="kd">function</span><span class="p">(</span><span class="nx">event</span><span class="p">){</span> </span><span id="L-2"><a name="L-2"></a> <span class="kd">var</span> <span class="nx">$et</span> <span class="o">=</span> <span class="nx">$</span><span class="p">(</span> <span class="nx">event</span><span class="p">.</span><span class="nx">target</span> <span class="p">),</span> </span><span id="L-3"><a name="L-3"></a> <span class="nx">pageID</span> <span class="o">=</span> <span class="s1">&#39;#pagina2&#39;</span><span class="p">;</span> </span><span id="L-4"><a name="L-4"></a> <span class="k">if</span><span class="p">(</span> <span class="nx">$et</span><span class="p">.</span><span class="nx">is</span><span class="p">(</span> <span class="nx">pageID</span> <span class="p">)</span> <span class="o">||</span> <span class="nx">$et</span><span class="p">.</span><span class="nx">children</span><span class="p">(</span><span class="mi">0</span><span class="p">).</span><span class="nx">is</span><span class="p">(</span> <span class="nx">pageID</span> <span class="p">)</span> <span class="p">){</span> </span><span id="L-5"><a name="L-5"></a> <span class="c1">//qui lo script</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>
"jquery mobile"

JavaScript

programatically navigate using jquerymobile 1.0a2

$.mobile.changePage(to, transition, back, changeHash);
https://snipt.net/embed/e70eaab8666c372d84150d3021b5e402/
https://snipt.net/raw/e70eaab8666c372d84150d3021b5e402/
e70eaab8666c372d84150d3021b5e402
js
JavaScript
1
2016-11-26T14:03:45
True
False
False
/api/public/snipt/21502/
programatically-navigate-using-jquerymobile-10a2
<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="nx">$</span><span class="p">.</span><span class="nx">mobile</span><span class="p">.</span><span class="nx">changePage</span><span class="p">(</span><span class="nx">to</span><span class="p">,</span> <span class="nx">transition</span><span class="p">,</span> <span class="nx">back</span><span class="p">,</span> <span class="nx">changeHash</span><span class="p">);</span> </span></pre></div> </td></tr></table>
"jquery mobile", hash, navigation

JavaScript

jquery mobile programatically setting the hash navigation with transitions

$('<a href="#path/to/some.file" data-transition="pop">').ajaxClick();
https://snipt.net/embed/48fb94601ebf4601c9687ea80eaa05c0/
https://snipt.net/raw/48fb94601ebf4601c9687ea80eaa05c0/
48fb94601ebf4601c9687ea80eaa05c0
js
JavaScript
1
2016-11-30T09:35:48
True
False
False
/api/public/snipt/20901/
jquery-mobile-programatically-setting-the-hash-navigation-with-transitions
<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="nx">$</span><span class="p">(</span><span class="s1">&#39;&lt;a href=&quot;#path/to/some.file&quot; data-transition=&quot;pop&quot;&gt;&#39;</span><span class="p">).</span><span class="nx">ajaxClick</span><span class="p">();</span> </span></pre></div> </td></tr></table>
"jquery mobile", hash, navigation

JavaScript

jquery mobile programatically setting the hash navigation

location.hash = "path/to/some.file";
https://snipt.net/embed/e0cde452a684303d860fc3f145f1eb75/
https://snipt.net/raw/e0cde452a684303d860fc3f145f1eb75/
e0cde452a684303d860fc3f145f1eb75
js
JavaScript
1
2016-11-24T05:12:28
True
False
False
/api/public/snipt/20899/
jquery-mobile-programatically-setting-the-hash-navigation
<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="nx">location</span><span class="p">.</span><span class="nx">hash</span> <span class="o">=</span> <span class="s2">&quot;path/to/some.file&quot;</span><span class="p">;</span> </span></pre></div> </td></tr></table>
"jquery mobile", hash, navigation
Copyrighted, illegal, or inappropriate content? Email [email protected].