Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>As per my understanding, you can use "toggle()" function which does exactly the same (i.e, toggle visiblity).</p> <pre><code>$('#DrawerContainer').toggle(); </code></pre> <p><strong>EDIT:</strong> Updated the script to work.</p> <pre><code>$(document).ready(function() { $.ajaxSetup({cache: false}); $('#portfolio-list&gt;div:not(#DrawerContainer)').click(function() { if ($(this).attr("id") != "current") { // modify hash for sharing purpose (remove the first part of the href) var pathname = $(this).find('a')[0].href.split('/'), l = pathname.length; pathname = pathname[l-1] || pathname[l-2]; window.location.hash = "#!" + pathname; $('#current').removeAttr('id'); $(this).attr('id', 'current'); // find first item in next row var LastInRow = -1; var top = $(this).offset().top; if ($(this).next().length == 0 || $(this).next().offset().top != top) { LastInRow = $(this); } else { $(this).nextAll().each(function() { if ($(this).offset().top != top) { return false; // == break from .each() } LastInRow = $(this); }); } if (LastInRow === -1) { LastInRow = $(this).parent().children().last(); } // Ajout du drawer var post_link = $(this).find('.mosaic-backdrop').attr("href"); $('#DrawerContainer').remove(); // remove existing, if any $('&lt;div/&gt;').attr('id', 'DrawerContainer').css({display: 'none'}).data('citem', this).html("loading...").load(post_link + " #container &gt; * ").insertAfter(LastInRow).slideDown(300); return false; // stops the browser when content is loaded } else { $('#DrawerContainer').slideUp(300); $(this).removeAttr("id"); } }); $(document).ajaxSuccess(function() { Cufon('h1'); //refresh cufon // Toggle/close the drawer $("#current,.CloseDrawer").click(function() { $('#DrawerContainer').slideToggle() setTimeout(function(){ // then remove it... $('#DrawerContainer').remove(); }, 300); // after 500ms. return false; }); }); //updated Ene's version var hash = window.location.hash; if ( hash.length &gt; 0 ) { hash = hash.replace('#!' , '' , hash ); $('a[href$="'+hash+'/"]').trigger('click'); } }); </code></pre> <p>Also, updated it here: <a href="http://jsfiddle.net/RF6df/32/" rel="nofollow">Updated JS Fiddle</a></p> <p><strong>EDIT -2:</strong> <a href="http://jsfiddle.net/RF6df/55/" rel="nofollow">Updated Link</a> </p> <p>Hope this Helps!!</p>
 

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