Last active
December 23, 2019 23:54
-
-
Save m3g4p0p/71df72f5ba42c68e6f1bde81b9e0084e to your computer and use it in GitHub Desktop.
Dynamic content test page
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
<h1>bar</h1> |
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
<h1>foo</h1> | |
<a href="./bar.html">bar</a> |
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> | |
<html lang="en"> | |
<head> | |
<meta charset="UTF-8"> | |
<meta name="viewport" content="width=device-width, initial-scale=1.0"> | |
<title>Dynamic content test page</title> | |
<style> | |
.container { | |
padding: 10px; | |
margin: 10px; | |
border: 1px solid blue; | |
} | |
</style> | |
</head> | |
<body> | |
<div class="container"> | |
<a href="./foo.html">foo</a> | |
</div> | |
<div class="container"> | |
<a href="./bar.html">bar</a> | |
</div> | |
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script> | |
<script> | |
$(document.body).on('click', '.container a', function (event) { | |
event.preventDefault() | |
$(this).closest('.container').load(event.target.href) | |
}) | |
</script> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment