mediawiki-extensions-Visual.../demos/playground/iframe.html

42 lines
1.6 KiB
HTML
Raw Normal View History

<!DOCTYPE html>
<html>
<head>
<title>iFrame Selection Demo</title>
<style>
.myframe {
background: #EEE;
border: 1px solid #AAA;
bottom: 5px;
display: none;
height: 50px;
position: absolute;
right: 5px;
width: 200px;
}
</style>
<script src="../../modules/rangy/rangy-core.js"></script>
<script src="../../modules/jquery/jquery.js"></script>
</head>
<body>
<div contenteditable="true">
<p>This is some text that is in the main document. This is some text that is in the main document. This is some text that is in the main document. This is some text that is in the main document. This is some text that is in the main document. This is some text that is in the main document. This is some text that is in the main document. This is some text that is in the main document. This is some text that is in the main document. This is some text that is in the main document. This is some text that is in the main document. This is some text that is in the main document. This is some text that is in the main document. This is some text that is in the main document. This is some text that is in the main document.</p>
</div>
<iframe class="myframe" src="iframe2.html"></iframe>
<script>
$(function() {
$('body').on('mouseup', function() {
var sel = rangy.getSelection();
var range = sel.getRangeAt(0);
if (!range.collapsed) {
$('iframe').show();
} else {
$('iframe').hide();
}
});
});
</script>
</body>
</html>