code_junkie

How to slide content opening up with jquery

Nov 12th, 2011
96
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.55 KB | None | 0 0
  1. <div id="footer">
  2. <div id="expandingFooter"> hidden content</div>
  3. content that is always visible
  4. </div>
  5.  
  6. $('#expandingFooter').slideToggle();
  7.  
  8. $('#toggleButton').bind('click', function(e) {
  9. $('#expandingFooter').toggle('slide', {easing: 'easeOutQuint', direction: 'down'}, 1000);
  10. });
  11.  
  12. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
  13. "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  14. <html>
  15. <head>
  16. <title>Untitled</title>
  17. <script type="text/javascript" src="shared-scripts/jquery-1.2.4b.js"></script>
  18. <script type="text/javascript">
  19. <!--
  20. $(document).ready(function(){
  21. $("#footer").click(function () {
  22. if ($("#expandingFooter").is(":hidden")) {
  23. $("#expandingFooter").show("slow");
  24. } else {
  25. $("#expandingFooter").slideUp();
  26. }
  27. });
  28. $("#expandingFooter").hide();
  29. });
  30. //--></script>
  31.  
  32. </head>
  33.  
  34. <body>
  35. <div id="footer">
  36. <div id="expandingFooter"> hidden content</div>
  37. content that is always visible
  38. </div>
  39. </body>
  40. </html>
  41.  
  42. <a id="toggle">Toggle()</a>
  43.  
  44. <div id="slide" style="position:relative; height: 100px">
  45.  
  46. <div id="slideInner" style="position:absolute; bottom: 0; background: lightblue"">
  47. <p>Suspendisse potenti. Vivamus libero. Dummy Text</p>
  48. </div>
  49.  
  50. </div>
  51.  
  52.  
  53. <script type="text/javascript">
  54. $('.hoverable').hover( function() { $(this).find("div").show(); },
  55. function() { $(this).find("div").hide(); } );
  56.  
  57. $('#toggle').click(function () {
  58. $('#slideInner').slideToggle();
  59. });
  60. </script>
Add Comment
Please, Sign In to add comment