I stumbled upon this message while trying to accomplish the same task.
Unfortunately, Matt's answer will no longer work with the latest version of jQuery. At the time Matt's answer was written, jQuery had two functions. At the time I write this, the one used in his answer is out of date. If Matt code is used, the whole div will just disappear, the button and thatβs it. (And if you look like me, it will be very confusing until you delve into the api documentation and find out about the change)
I got the opportunity to work with the following code:
HTML:
<div id="siteMap"> <div id="mapButton">Site Map</div> <div id="theMap">[The Site Map Goes Here]</div> </div>
CSS (I know this is not very clean yet):
#siteMap { width:500px; position:fixed; left:-500px; top:157px; display:block; color:#FFF; z-index:2; opacity: 0.95; } #siteMap #mapButton { display:block; color:#333; background-color:#ACACAC; padding:2px 5px; height:20px; width:70px; text-align:center; position:relative; left: 100%; margin-top:80px; cursor:pointer; transform-origin: 0% 0%; -ms-transform-origin: 0% 0%; -webkit-transform-origin: 0% 0%; -moz-transform-origin: 0% 0%; -o-transform-origin: 0% 0%; transform: rotate(-90deg); -ms-transform: rotate(-90deg); -webkit-transform: rotate(-90deg); -moz-transform: rotate(-90deg); -o-transform: rotate(-90deg); } #siteMap #theMap { width:100%; height:350px; background-color:#666; margin-top:-104px; }
And finally JavaScript:
<script type='text/javascript'> $(document).ready(function() { $('#mapButton').click(function() { var mapPos = parseInt($('#siteMap').css('left'), 10); if (mapPos < 0) { $('#siteMap').animate({ left: '+=500' }, 458, 'swing', function() { </script>
I hope if you came here from Google, my post will be useful :)
Ted A.
source share