Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <!DOCTYPE html>
- <html>
- <head>
- <title>jQuery Image Captions Tutorial | alijafarian.com</title>
- <style type="text/css">
- * {
- margin: 0;
- padding: 0;
- }
- body {
- font-family: Arial, Helvetica, sans-serif;
- font-size: 100%;
- color: #666;
- }
- #wrapper {
- margin: 20px auto;
- width: 960px;
- }
- h1 {
- text-align: center;
- margin: 0 0 20px;
- }
- .grid-block-container {
- float: left;
- width: 990px;
- margin: 20px 0 0 -30px;
- }
- .grid-block {
- position: relative;
- float: left;
- width: 300px;
- height: 200px;
- margin: 0 0 30px 30px;
- }
- .grid-block h4 {
- font-size: .9em;
- color: #333;
- background: #f5f5f5;
- margin: 0;
- padding: 10px;
- border: 1px solid #ddd;
- }
- .caption {
- display: none;
- position: absolute;
- bottom: 0;
- left: 0;
- background: url(images/trans-black-50.png);
- width: 100%;
- height: 100%;
- }
- .caption h3, .caption p {
- color: #fff;
- margin: 20px;
- }
- .caption h3 {
- margin: 20px 20px 10px;
- }
- .caption p {
- font-size: .75em;
- line-height: 1.5em;
- margin: 0 20px 15px;
- }
- .caption a.learn-more {
- padding: 5px 10px;
- background: #08c;
- color: #fff;
- border-radius: 2px;
- -moz-border-radius: 2px;
- font-weight: bold;
- text-decoration: none;
- }
- .caption a.learn-more:hover {
- background: #fff;
- color: #08c;
- }
- </style>
- </head>
- <body>
- <div id="wrapper">
- <div class="grid-block-container">
- <!--/.grid-block-->
- <!--/.grid-block-->
- <div class="grid-block slide"> <img src="http://crossfiremedia.realpage.com/voyageratthespace/photos/ph1065_w1050_h174.png" />
- <div class="caption">
- <h3>Caption Title</h3>
- <p>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.</p>
- <p><a href="#" class="learn-more">Learn more</a></p>
- </div>
- </div>
- <!--/.grid-block-->
- </div>
- <!--/.grid-container-->
- </div>
- <!--/.wrapper-->
- <!---------- JS ---------->
- <script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js"></script>
- <script type="text/javascript">
- jQuery(document).ready(function($) {
- $('.slide').hover(function () {
- $(this).children('.caption').slideToggle(250);
- });
- });
- </script>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment