Note that there are some explanatory texts on larger screens.

plurals
  1. POjQuery not working on site, but works on jsfiddle
    primarykey
    data
    text
    <p>The following code put together by stefanz works great on jsfiddle, but I cannot get it working on my local wordpress site..</p> <p>Here is the fiddle: <a href="http://fiddle.jshell.net/9ae3T/" rel="nofollow">http://fiddle.jshell.net/9ae3T/</a></p> <p>Here is the code:</p> <pre><code>&lt;ul class="tabs js-view-mode"&gt; &lt;li&gt;&lt;a href="#list"&gt;List&lt;/a&gt;&lt;/li&gt; &lt;li&gt;&lt;a href="#grid"&gt;Grid&lt;/a&gt;&lt;/li&gt; &lt;li&gt;&lt;a href="#full"&gt;Full&lt;/a&gt;&lt;/li&gt; &lt;/ul&gt; &lt;section id="viewMode"&gt; &lt;div id="list"&gt;here is list mode content&lt;/div&gt; &lt;div id="grid"&gt;here is grid mode content&lt;/div&gt; &lt;div id="full"&gt;here is full mode content&lt;/div&gt; &lt;/section&gt; $(document).ready(function(){ var wrap = $('#viewMode'), viewMode = $.cookie( 'view-mode' ); wrap.children().hide(); $('.js-view-mode').on( 'click', 'a',function( e ){ e.preventDefault(); var t = $(this), type = t.attr('href'); $(type).fadeIn() .siblings().fadeOut(); viewMode = $.cookie( 'view-mode', type ); }); if ( viewMode ) { $('.js-view-mode a[href='+ viewMode +']').trigger('click'); } else { $('.js-view-mode li:first a').trigger( 'click' ); } }); </code></pre> <p>Does anyone have a suggestion? This is what I have in my head (viewmode.js is the above code):</p> <pre><code>&lt;script language="javascript" type="text/javascript" src="&lt;?php echo bloginfo('stylesheet_directory') ?&gt;/js/viewmode.js"&gt;&lt;/script&gt; &lt;script language="javascript" type="text/javascript" src="&lt;?php echo bloginfo('stylesheet_directory') ?&gt;/js/cookie.js"&gt;&lt;/script&gt; &lt;script src="//ajax.googleapis.com/ajax/libs/jquery/1.10.0/jquery.min.js"&gt;&lt;/script&gt; </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    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.
 

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