Created
March 23, 2010 00:09
-
-
Save deepthawtz/340711 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <!DOCTYPE html> | |
| <head> | |
| <script src="http://www.google.com/jsapi" language="javascript"></script> | |
| <script language="javascript"> | |
| google.load("jquery", "1.4.2") | |
| </script> | |
| <style> | |
| #img-carousel { | |
| height: 100px; | |
| width: 700px; | |
| position: relative; | |
| white-space: nowrap; | |
| z-index:0; | |
| margin: 40px 0 60px 10px; | |
| } | |
| .item { | |
| font-size: 1.3em; | |
| height: 80px; | |
| padding:5px; | |
| border: 1px solid #ddd; | |
| display: inline-block; | |
| margin-top: 10px; | |
| margin-right: 10px; | |
| z-index:0; | |
| } | |
| </style> | |
| </head> | |
| <body> | |
| <div id='img-carousel'> | |
| <a href='http://surr.chrisburbridge.com/projects/architecture/campana-residence'> | |
| <img src='http://surr.chrisburbridge.com/uploads/images/carousel-thumbs/projects/architecture/campana-residence.1.jpg' id='item-1' class='item leftmost'/> | |
| </a> | |
| <a href='http://surr.chrisburbridge.com/projects/architecture/campana-residence'> | |
| <img src='http://surr.chrisburbridge.com/uploads/images/carousel-thumbs/projects/architecture/campana-residence.2.jpg' id='item-2' class='item'/> | |
| </a> | |
| <a href='http://surr.chrisburbridge.com/projects/landscape/cerrillos-guest-house'> | |
| <img src='http://surr.chrisburbridge.com/uploads/images/carousel-thumbs/projects/landscape/cerrillos-guest-house.1.jpg' id='item-3' class='item'/> | |
| </a> | |
| <a href='http://surr.chrisburbridge.com/projects/landscape/cerrillos-guest-house'> | |
| <img src='http://surr.chrisburbridge.com/uploads/images/carousel-thumbs/projects/landscape/cerrillos-guest-house.2.jpg' id='item-4' class='item'/> | |
| </a> | |
| <a href='http://surr.chrisburbridge.com/projects/landscape/cerrillos-guest-house'> | |
| <img src='http://surr.chrisburbridge.com/uploads/images/carousel-thumbs/projects/landscape/cerrillos-guest-house.3.jpg' id='item-5' class='item'/> | |
| </a> | |
| </div> | |
| <script type="text/javascript" charset="utf-8"> | |
| $(document).ready(function() { | |
| // get position while all elements are in relative context | |
| $('.item').each(function() { | |
| var relative_left = $(this).position().left + 'px' | |
| var original_width = $(this).width() + 'px' | |
| // stash attrs for access later | |
| $(this).attr('relative-left', relative_left) | |
| $(this).attr('original-width', original_width) | |
| }) | |
| // now that we have the positioning, it is safe to apply those | |
| // positions in an absolute context | |
| $('.item').each(function(){ | |
| $(this).css('position', 'absolute') | |
| $(this).css('left', $(this).attr('relative-left')) | |
| }) | |
| }) | |
| </script> | |
| </body> | |
| </html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment