-
Notifications
You must be signed in to change notification settings - Fork 10
/
index.html
173 lines (142 loc) · 6.13 KB
/
index.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="description" content="">
<meta name="author" content="">
<link rel="icon" href="favicon.ico">
<title>Index</title>
<!-- Bootstrap core CSS -->
<link rel="stylesheet" href="css/bootstrap.min.css">
<link rel="stylesheet" href="//cdnjs.cloudflare.com/ajax/libs/highlight.js/8.9.1/styles/default.min.css">
<link rel="stylesheet" href="css/monokai_sublime.css">
<link rel="stylesheet" href="css/style.css">
<!-- HTML5 shim and Respond.js for IE8 support of HTML5 elements and media queries -->
<!--[if lt IE 9]>
<script src="https://oss.maxcdn.com/html5shiv/3.7.2/html5shiv.min.js"></script>
<script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
<![endif]-->
</head>
<body>
<!-- Fixed navbar -->
<nav class="navbar navbar-default">
<div class="container">
<div class="navbar-header">
<button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#navbar" aria-expanded="false" aria-controls="navbar">
<span class="sr-only">Toggle navigation</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a class="navbar-brand" href="http://maxazan.github.io/jquery-ui-droppable-iframe/">jquery-ui-droppable-iframe</a>
</div>
<div id="navbar" class="collapse navbar-collapse navbar-right">
<ul class="nav navbar-nav">
<li ><a href="https://github.com/maxazan/jquery-ui-droppable-iframe">View on github</a></li>
<li ><a href="https://github.com/maxazan/jquery-ui-droppable-iframe/archive/master.zip">Download</a></li>
</ul>
</div><!--/.nav-collapse -->
</div>
</nav>
<style type="text/css">
.draggable{border: 1px solid black; width: 100px; height: 50px;}
</style>
<div class="container">
<div class="row">
<h2 class="text-center">Use your droppable zones inside iframe!</h2>
<p>As you know <a href="https://jqueryui.com/">jquery-ui</a> does not maintaining use droppable zones inside iframe. Use <a href="http://maxazan.github.io/jquery-ui-droppable-iframe/">jquery-ui-droppable-iframe</a> to fix this!</p>
<div class="well">
<p>Plugin features</p>
<ul>
<li>Fix droppable position inside iframe</li>
<li>You can use iframe scroll, while you are dragging</li>
<li>After scroll droppable position works perfect</li>
<li>Works even in IE and Edge</li>
<li>You can use native <code>scrollSensitivity</code> and <code>scrollSpeed</code> params</li>
</ul>
</div>
<h2 class="text-center">Try it now</h2>
<div class="draggable">Drag me</div><br><br>
<iframe id="testframe" frameborder="0" style="width:100%; height:200px; border:1px solid #e7e7e7;"></iframe>
</div>
<h2>Usage</h2>
<pre><code><!--jquery -->
<script type="text/javascript" src="js/jquery-1.11.3.min.js"></script>
<!--jquery UI -->
<script type="text/javascript" src="js/jquery-ui-1.11.4.custom.js"></script>
<!-- jquery-ui-droppable-iframe -->
<script type="text/javascript" src="jquery-ui-droppable-iframe.js"></script>
<!--Activate drag and drop zones -->
<script type="text/javascript">
$(function() {
//After frame loaded
$("#testframe").attr('src','iframe.html').load(function() {
//Activate droppable zones
$(this).contents().find('.droppable').droppable({
drop: function(event, ui) {
//ACTION ON DROP HERE
}
});
});
//Activate draggable zones
$('.draggable').draggable({
iframeFix: true, //Core jquery ui params needs for fix iframe bug
iframeScroll: true //This param needs for activate iframeScroll
});
});
</script>
</code></pre>
</div>
<!-- /END THE FEATURETTES -->
<!-- FOOTER -->
<div class="container">
<footer>
<p class="pull-right"><a href="#">Back to top</a></p>
<p>© 2015 Maksym Pomazan</p>
</footer>
</div>
<!-- Bootstrap core JavaScript -->
<script src="//cdnjs.cloudflare.com/ajax/libs/highlight.js/8.9.1/highlight.min.js"></script>
<script>hljs.initHighlightingOnLoad();</script>
<script type="text/javascript" src="js/jquery-1.11.3.min.js"></script>
<script type="text/javascript" src="js/jquery-ui-1.11.4.custom.js"></script>
<script type="text/javascript" src="js/jquery.ui.touch-punch.min.js"></script>
<script type="text/javascript" src="jquery-ui-droppable-iframe.js"></script>
<!-- IE10 viewport hack for Surface/desktop Windows 8 bug -->
<script src="js/ie10-viewport-bug-workaround.js"></script>
<script type="text/javascript">
$(function() {
$("#testframe").attr('src','iframe.html').load(function() {
var iframe = $(this).contents();
iframe.find('.droppable').droppable({
hoverClass: "ui-droppable-hover",
activeClass: "ui-droppable-active",
tolerance: "pointer",
drop: function(event, ui) {
console.log("DROP");
}
});
});
$('.draggable').draggable({
scroll: true,
iframeScroll:true,
scrollSensitivity:20,
iframeFix: true,
opacity: 0.35,
helper: "clone",
revert: "invalid"
});
});
</script>
<script>
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
})(window,document,'script','//www.google-analytics.com/analytics.js','ga');
ga('create', 'UA-43342702-3', 'auto');
ga('send', 'pageview');
</script>
</body>
</html>