Created
February 11, 2013 15:01
-
-
Save eduardolundgren/4754923 to your computer and use it in GitHub Desktop.
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
<h1>Content 1</h1> | |
<a href="content2.html">Link from HTML snippet being intercepted</a><br> |
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
<h1>Content 2</h1> | |
<a href="content1.html">Link from HTML snippet being intercepted</a><br> |
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
<!doctype html> | |
<html lang="en"> | |
<head> | |
<meta charset="UTF-8"> | |
<title></title> | |
<link rel="stylesheet" href="../../build/aui-css/css/bootstrap.css"> | |
<script src="../../build/aui/aui.js"></script> | |
<style> | |
.aui-dialog { | |
margin: 20px; | |
background: #f9f9f9; | |
} | |
</style> | |
</head> | |
<body> | |
<h1>AlloyUI - dumb bigpipe</h1> | |
<div class="aui-dialog"> | |
Lorem ipsum dolor sit amet, consectetur adipisicing elit. Quis explicabo laborum excepturi at culpa quas veritatis eaque id dignissimos minus eligendi voluptatum deleniti eius quia saepe sit nobis ratione maiores. | |
<a href="content1.html">I'm a regular link.</a> | |
Lorem ipsum dolor sit amet, consectetur adipisicing elit. Modi magnam nisi voluptatem inventore. Iste veniam nesciunt esse aliquid autem nisi ipsam architecto quibusdam accusamus vel commodi aut sit veritatis non! | |
<a href="content1.html">I'm a regular link again.</a> | |
</div> | |
<script> | |
YUI({ filter:'raw' }).use('aui-io', 'aui-node', 'node-event-delegate', 'node-load', function(A) { | |
// intercepting links... | |
A.getDoc().delegate('click', function(event) { | |
var anchor = event.currentTarget, | |
dialogNode = anchor.ancestor('.aui-dialog'), | |
href = anchor.getAttribute('href'); | |
if (!href || !dialogNode) { | |
return; | |
} | |
dialogNode.load(href); | |
event.preventDefault(); | |
}, 'a'); | |
}); | |
</script> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment