Guest User

Untitled

a guest
Aug 21st, 2018
83
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.07 KB | None | 0 0
  1. How do I get a fragment to load from an unspecified html?
  2. <div id="header">
  3. <h1>N300 Project Gallery</h1>
  4. </div>
  5. <div id="container">
  6. <div id="utility">
  7. <ul>
  8. <li><a href="about.html">About</a></li>
  9. <li><a href="projects.html">Projects</a></li>
  10.  
  11. </ul>
  12.  
  13. </div>
  14. <div id="index-content">?</div>
  15. <div id="footer">This is the footer</div>
  16. </div>
  17.  
  18. $(document).ready(function() {
  19.  
  20. $('#utility a').click(function(e){
  21. e.preventDefault();
  22. $('#utility').hide('normal',loadContent);
  23. });
  24. function loadContent() {
  25. $('#index-content').load(url+ '#content')
  26. }
  27. });
  28.  
  29. <div id="content">
  30. <p>Hello! My name is Brittany Shephard.</p>
  31. </div>
  32.  
  33. function loadContent() {
  34. $('#index-content').load($(this).attr('href')+ ' #content');
  35. }
  36.  
  37. $(document).ready(function() {
  38.  
  39. $('#utility a').click(function(e){
  40. e.preventDefault();
  41. $('#utility').hide('normal', function() {
  42. loadContent($(e.target).attr('href'));
  43. });
  44. });
  45.  
  46. function loadContent(url) {
  47. $('#index-content').load(url + ' #content');
  48. }
  49. });
Add Comment
Please, Sign In to add comment