Note that there are some explanatory texts on larger screens.

plurals
  1. POHow to animate size on these nested div elements? (jQuery)
    primarykey
    data
    text
    <p>I created a spinning gear with <a href="http://codepen.io/leongaban/pen/wJAip" rel="nofollow noreferrer">CSS animations</a>. Now I want the entire spinning gear div to animate in from <code>1%</code> to <code>110%</code> to <code>100%</code> then back down to <code>1%</code>. Or basically <code>1px</code> to <code>90px</code> to <code>80px</code>(normal size) then back down to <code>1px</code>.</p> <p>Right now the jQuery I'm using on the elements inside the <code>#spinner</code> div is animating it, but it's still off. The animation should act like CSS transition scale, where it zooms up from 1% to 110%. At the moment my animation is off center.</p> <p>Any thoughts?</p> <p><strong>jsFiddle: <a href="http://jsfiddle.net/leongaban/d7UjD/681/" rel="nofollow noreferrer">http://jsfiddle.net/leongaban/d7UjD/681/</a></strong><br/> <strong>NEW CodePen: <a href="http://codepen.io/leongaban/pen/wJAip" rel="nofollow noreferrer">http://codepen.io/leongaban/pen/wJAip</a></strong></p> <p>Would I have to animate each element in the <code>#spinner</code> div?</p> <p><img src="https://i.stack.imgur.com/jMyV1.png" alt="enter image description here"></p> <hr> <p>jQuery for Zoom in and out Animations:</p> <pre><code>function firstAnimate() { $('#spinner').animate({width: "110px", height: "110px"}, secoundAnimate); } function secoundAnimate() { $('#spinner').animate({width: "80px", height: "80px"}, 'slow', thirdAnimate); } function thirdAnimate() { $('#spinner').animate({width: "1px", height: "1px"}, 'fast', fourthAnimate); } function fourthAnimate() { $('#spinner').hide; } firstAnimate(); </code></pre> <p><br/> My spinning gear HTML:</p> <pre><code>&lt;div id="spinner"&gt; &lt;div id="logo"&gt; &lt;img src="http://leongaban.com/_codepen/whoat/loader-logo.png"/&gt; &lt;/div&gt; &lt;div id="gear" class="spin"&gt; &lt;img src="http://leongaban.com/_codepen/whoat/loader-gear.png"/&gt; &lt;/div&gt; &lt;/div&gt; </code></pre> <p><br/> The CSS:</p> <pre><code>#spinner { position: absolute; width: 80px; height: 80px; top: 35%; left: 50%; margin-left: -40px; background: blue; } #logo { position: absolute; top: 0; left: 0; width: 80px; height: 80px; z-index: 3; } #logo img { width: 100%; height:100%; } #gear { position: absolute; top: 0; left: 0; -webkit-transition: -webkit-transform 0.1s; transition: transform 0.1s; -webkit-transform: translateX(100%) translateY(-100%) rotate(45deg); transform: translateX(100%) translateY(-100%) rotate(45deg); z-index: 2; } #gear img { display:block; } </code></pre>
    singulars
    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.
    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