Last active
August 29, 2015 14:16
-
-
Save jljohnstone/1676b3870a0049d0913c to your computer and use it in GitHub Desktop.
display a page inside of a div in another 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
<!DOCTYPE html> | |
<html> | |
<head> | |
<title>There's a page in my div</title> | |
<style type="text/css"> | |
.the-div { | |
border: 1px solid #555; | |
} | |
</style> | |
</head> | |
<body> | |
<p><a href="page.html" class="open-in-div">click the link</a> and a page will appear in the div below</p> | |
<div class="the-div"></div> | |
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.3/jquery.min.js"></script> | |
<script> | |
$('.open-in-div').click(function(e) { | |
e.preventDefault(); | |
$('.the-div').load($(this).attr('href')); | |
}); | |
</script> | |
</body> | |
</html> |
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> | |
<head> | |
<title>I'm that page</title> | |
</head> | |
<body> | |
<p>I'm a page that is displayed in a div</p> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment