Last active
August 29, 2015 14:00
-
-
Save cameronbaney/11218524 to your computer and use it in GitHub Desktop.
External page content into CSS3 Modal
This file contains 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
$('.btn.go').on('click',function(){ | |
// Set the modal's content as a variable for achcing | |
$modalContent = $('.modal-content'); | |
// Add a loading signifier | |
$modalContent.html('Loading...'); | |
// Get the external URL | |
$.ajax({ | |
url: $(this).attr('href'), | |
}) | |
// When ajax has an error | |
.error(function(){ | |
$modalContent.html('Sorry, an error has occured. Please try again.'); | |
}) | |
// When ajax is successful | |
.success(function(data){ | |
$modalContent.html(data); | |
}); | |
}); |
This file contains 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
<div class="header"> | |
<h2>Modal Heading</h2> | |
</div> | |
<div class="copy"> | |
<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.</p> | |
</div> | |
<div class="cf footer"> | |
<a href="#" class="btn">Close</a> | |
</div> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment