Note that there are some explanatory texts on larger screens.

plurals
  1. PONeed help reversing a function; reverting an animated expansion of a div
    primarykey
    data
    text
    <p>I'm new to jQuery, so please forgive me if this is asinine. If so, please point me to a place where I can gain some knowledge.</p> <p>Here's what I'm doing: I have a Wordpress (hence compatibility mode) layout that is a bunch of divs arranged using <a href="http://isotope.metafizzy.co/" rel="nofollow">isotope</a>. When a user clicks on a div, it expands out to a certain size using .animate() and then isotope sorts all of the divs by width. </p> <p>This all runs beautiful and I'm very happy with it. The problem is I've got all forward and no reverse. I want to add a button that reverts the div to it's original state (width: 156px height: 191px). This is where my green status is really showing. I've tried just reverse engineering everything I've already done when a close link is clicked, but all I've been able to achieve is shrinking the div only to have it immediately shoot back to the expanded size.</p> <p>If someone can point me in the right direction, I'd be forever in your debt. Also, if I can provide you with any more information just let me know and I'll get right on it. Thank you so much.</p> <pre><code>jQuery().ready(function() { // Variables - Project Tiles var $tile = jQuery(".tile"); //Expands tile on click jQuery($tile).click(function(){ $tile .stop() jQuery(this).addClass('expanded'); //change cell's class jQuery(".tile-content", this).hide(); //hide starting content jQuery(this).animate({ //animate the expansion of the cell width: '933px', height: 'auto', }, "slow", function() { //things to do after animation jQuery(".expanded-content", this).fadeIn('slow'); //show post content jQuery("#content").isotope({ //re-arrange tiles sortBy : 'width', }); }); }); // close tile }); </code></pre>
    singulars
    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.
 

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