Here's what I've got so far:
http://jsfiddle.net/phantasmix/nAaMV/
1) The top button works on click just fine. How can I make the bottom button work the same way? Both will be shown on the same page.
2) Another issue is that the blue background is visible on the right. Is there any way to hide the blue background until it shows up to the left of the button?
CSS:
#button-top { width: 100px; position: absolute; left: 75%; top: 40px; padding-left: 100px; overflow: hidden;}
#button-top:hover,
#button-bottom:hover { cursor: pointer;}
.slide { position: relative; height: 100px; overflow: hidden; width: 350px; }
.slide img {position: relative; z-index: 100;}
.slide .innerTop, .slide .innerBottom { position: absolute; left: 0; top: 10px; width: 200px; height: 90px; padding: 6px; background: url(http://i39.tinypic.com/nz4ldw.png) 0 0 no-repeat; z-index: 50; }
.slide .innerTop p, .slide .innerBottom p { width: 80px; padding:8px 16px; color: #fff; margin: 0; }
.js .slide .innerTop, .js .slide .innerBottom { display: none; }
#button-bottom { width: 100px; position: absolute; left: 75%; top: 240px; padding-left: 100px; overflow: hidden;}
SCRIPT:
- $(document).ready(function () {
- var $marginLefty = $('#button-top div.innerTop');
- $marginLefty.css({
- marginLeft: $marginLefty.outerWidth() + 'px',
- display: 'block'
- });
- $('#button-top img').click(function () {
- $marginLefty.animate({
- marginLeft: parseInt($marginLefty.css('marginLeft'), 10) == 0 ? $marginLefty.outerWidth() : 0
- });
- });
- });
HTML:
- <div class="slide" id="button-top"> [IMG LINK]
- <div class="innerTop">
- <p>HIDDEN SLIDING CONTENT</p>
- </div>
- </div>
- <div class="slide" id="button-bottom"> [IMG LINK]
- <div class="innerBottom">
- <p>HIDDEN SLIDING CONTENT</p>
- </div>
- </div>