Is it possible to combine animate with scale somehow? The blue tab is longer than the white button, so I figure the only way to hide the blue under the white completely is to scale blue to 50% width as it slides back.
I'm open to other suggestions on how to achieve this. Thanks!
Current code:
JSFiddleHTML:- <div class="hide-mobile" id="button-top">
- <img src="http://i43.tinypic.com/dcajis.png" alt="" />
- <div class="slide innerTop"><p>HIDDEN SLIDING CONTENT</p></div>
- </div>
- <div class="hide-mobile" id="button-bottom">
- <img src="http://i43.tinypic.com/dcajis.png" alt="" />
- <div class="slide innerBottom"><p>HIDDEN SLIDING CONTENT</p></div>
- </div>
CSS:- #button-top { width: 112px; height: 112px; position: absolute; left: 73%; top: 40px; padding-left: 100px; padding-right: 5px; overflow: hidden; z-index: 200; }
- .slide { position: relative; height: 100px; overflow: hidden; width: 350px;}
- .slide img {position: relative; z-index: 100;}
- .slide p {width: 70px; padding:12px; color: #fff; margin: 0; }
- .innerTop, .innerBottom { position: absolute; left: 110px; top: 0; width: 260px; height: 90px; margin: 12px; background: #0d90cd; overflow: hidden; z-index: -1;
-webkit-border-radius:30px 0 0 30px;
-moz-border-radius:30px 0 0 30px;
border-radius:30px 0 0 30px; }
- #button-bottom { width: 112px; height: 112px; position: absolute; left: 73%; top: 180px; padding-left: 100px; padding-right: 5px; overflow: hidden; z-index: 100;}
- #button-top:hover, #button-bottom:hover {cursor: pointer;}
SCRIPT:- $('#button-top').toggle(function() {
- $('.innerTop').animate({'left':'3px'});
- }, function() {
- $('.innerTop').animate({'left':'103px'});
- });
- $('#button-bottom').toggle(function() {
- $('.innerBottom').animate({'left':'3px'});
- }, function() {
- $('.innerBottom').animate({'left':'103px'});
- });