Professional Documents
Culture Documents
From this basic idea we can play around with animations of the sliding element to either show or cover up the viewing area, thus creating the sliding effect.
6. background:#161613; 7. border: solid 2px #8399AF; 8. overflow: hidden; 9. position: relative; 10. } 11. .boxgrid img{ 12. position: absolute; 13. top: 0; 14. left: 0; 15. border: 0; 16. } If you arent using the semi-transparent captions you are done with CSS move to Step 2.
view plaincopy to clipboardprint?
1. .boxcaption{ 2. float: left; 3. position: absolute; 4. background: #000; 5. height: 100px; 6. width: 100%; 7. opacity: .8; 8. /* For IE 5-7 */ 9. filter: progid:DXImageTransform.Microsoft.Alpha(Opacity=80); 10. /* For IE 8 */ 11. -MS-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=80)"; 12. } Opacity that plays nice in all browsers is a rough topic, educate yourself if you need to. Now well need to set up the default starting point for the caption box. If you want it fully hidden initially, you will want the distance from the top or left to match the height or width of the window (.boxgrid), depending on which direction it will be sliding. You can also have it partially visible initially, as .caption .boxcaption illustrates.
view plaincopy to clipboardprint?
1. 2. 3. 4. 5. 6. 7. 8.
.captionfull .boxcaption { top: 260; left: 0; } .caption .boxcaption { top: 220; left: 0; }
1. $(document).ready(function(){ 2. //To switch directions up/down and left/right just place a "" in front of the top/left attribute
3. 4. 5. 6. 7. 8. 9. 10. 11. 12. 13. 14. 15. 16. 17. 18. 19. 20. 21. 22. 23. 24. 25. 26. 27. 28. 29. 30. 31. 32. 33. 34. 35. 36. 37. 38. 39.
//Vertical Sliding $('.boxgrid.slidedown').hover(function(){ $(".cover", this).stop().animate({top:'-260px'},{queue:false,duration:300}); }, function() { $(".cover", this).stop().animate({top:'0px'},{queue:false,duration:300}); }); //Horizontal Sliding $('.boxgrid.slideright').hover(function(){ $(".cover", this).stop().animate({left:'325px'},{queue:false,duration:300}); }, function() { $(".cover", this).stop().animate({left:'0px'},{queue:false,duration:300}); }); //Diagnal Sliding $('.boxgrid.thecombo').hover(function(){ $(".cover", this).stop().animate({top:'260px', left:'325px'},{queue:false,durati on:300}); }, function() { $(".cover", this).stop().animate({top:'0px', left:'0px'},{queue:false,duration:3 00}); }); //Partial Sliding (Only show some of background) $('.boxgrid.peek').hover(function(){ $(".cover", this).stop().animate({top:'90px'},{queue:false,duration:160}); }, function() { $(".cover", this).stop().animate({top:'0px'},{queue:false,duration:160}); }); //Full Caption Sliding (Hidden to Visible) $('.boxgrid.captionfull').hover(function(){ $(".cover", this).stop().animate({top:'160px'},{queue:false,duration:160}); }, function() { $(".cover", this).stop().animate({top:'260px'},{queue:false,duration:160}); }); //Caption Sliding (Partially Hidden to Visible) $('.boxgrid.caption').hover(function(){ $(".cover", this).stop().animate({top:'160px'},{queue:false,duration:160}); }, function() { $(".cover", this).stop().animate({top:'220px'},{queue:false,duration:160}); }); });
Heres an example of the HTML I would use for the .captionfull animation:
view plaincopy to clipboardprint?
1. <div class="boxgrid captionfull"> 2. <img src="jareck.jpg"/> 3. <div class="cover boxcaption"> 4. <h3>Jarek Kubicki</h3> 5. <p>Artist<br/><a href="<a class="linkificationext" title="Linkification: http://www.nonsensesociety.com/2009/03/art-by-jarekkubicki/" href="http://www.nonsensesociety.com/2009/03/art-by-jarekkubicki/">http://www.nonsensesociety.com/2009/03/art-by-jarekkubicki/</a>" target="_BLANK">More Work</a></p> </div>
6.
7. </div>